Skip to content

Commit 5c8917c

Browse files
authored
feat: skip E2E tests for dependency update commits (#710)
- Add _COMMIT_MESSAGE substitution to E2E triggers using payload binding - Skip E2E and Gemini Enterprise tests when commit starts with build(deps) - Reduces unnecessary CI costs for Dependabot PRs
1 parent 6fbe731 commit 5c8917c

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.cloudbuild/cd/test_e2e.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,28 @@ steps:
2020
args:
2121
- "-c"
2222
- |
23+
# Skip E2E tests for dependency updates (e.g., Dependabot PRs)
24+
if [[ "${_COMMIT_MESSAGE}" == build\(deps\)* ]]; then
25+
echo "Skipping E2E tests for dependency update: ${_COMMIT_MESSAGE}"
26+
touch /workspace/.skip-e2e
27+
exit 0
28+
fi
2329
uv sync --dev --locked
2430
25-
# Run unit tests using pytest
31+
# Run E2E tests using pytest
2632
- name: "europe-west4-docker.pkg.dev/production-ai-template/starter-pack/e2e-tests"
2733
id: e2e-tests
2834
entrypoint: /bin/bash
2935
args:
3036
- "-c"
3137
- |
38+
if [ -f /workspace/.skip-e2e ]; then
39+
echo "Skipping E2E tests - dependency update commit"
40+
exit 0
41+
fi
3242
GH_TOKEN=$$GITHUB_PAT uv run pytest tests/cicd/test_e2e_deployment.py -v
3343
secretEnv: ['GITHUB_PAT', 'GITHUB_APP_INSTALLATION_ID']
34-
44+
3545
availableSecrets:
3646
secretManager:
3747
- versionName: projects/${_SECRETS_PROJECT_ID}/secrets/github-pat/versions/latest
@@ -51,3 +61,4 @@ options:
5161
timeout: 43200s
5262
substitutions:
5363
_SECRETS_PROJECT_ID: 'asp-e2e-vars'
64+
_COMMIT_MESSAGE: ''

.cloudbuild/cd/test_gemini_enterprise.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ steps:
2020
args:
2121
- "-c"
2222
- |
23+
# Skip tests for dependency updates (e.g., Dependabot PRs)
24+
if [[ "${_COMMIT_MESSAGE}" == build\(deps\)* ]]; then
25+
echo "Skipping tests for dependency update: ${_COMMIT_MESSAGE}"
26+
touch /workspace/.skip-e2e
27+
exit 0
28+
fi
2329
uv sync --dev --locked
2430
2531
# Set gcloud project to dev environment
@@ -29,6 +35,10 @@ steps:
2935
args:
3036
- "-c"
3137
- |
38+
if [ -f /workspace/.skip-e2e ]; then
39+
echo "Skipping - dependency update commit"
40+
exit 0
41+
fi
3242
gcloud config set project ${_E2E_DEV_PROJECT}
3343
3444
# Fetch identity token for Cloud Run authentication
@@ -38,6 +48,10 @@ steps:
3848
args:
3949
- "-c"
4050
- |
51+
if [ -f /workspace/.skip-e2e ]; then
52+
echo "Skipping - dependency update commit"
53+
exit 0
54+
fi
4155
gcloud auth print-identity-token -q > /workspace/id_token.txt
4256
4357
# Run Gemini Enterprise registration test
@@ -47,6 +61,10 @@ steps:
4761
args:
4862
- "-c"
4963
- |
64+
if [ -f /workspace/.skip-e2e ]; then
65+
echo "Skipping Gemini Enterprise test - dependency update commit"
66+
exit 0
67+
fi
5068
export ID_TOKEN=$(cat /workspace/id_token.txt)
5169
uv run pytest tests/cicd/test_gemini_enterprise_registration.py -v
5270
secretEnv: ['GEMINI_ENTERPRISE_APP_ID']
@@ -62,3 +80,5 @@ options:
6280
env:
6381
- "RUN_GEMINI_ENTERPRISE_TEST=1"
6482
timeout: 3600s # 1 hour timeout
83+
substitutions:
84+
_COMMIT_MESSAGE: ''

.cloudbuild/terraform/build_triggers.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ resource "google_cloudbuild_trigger" "main_e2e_deployment_test" {
448448
_E2E_STAGING_PROJECT = var.e2e_test_project_mapping.staging
449449
_E2E_PROD_PROJECT = var.e2e_test_project_mapping.prod
450450
_SECRETS_PROJECT_ID = "asp-e2e-vars"
451+
_COMMIT_MESSAGE = "$(push.head_commit.message)"
451452
}
452453
}
453454

@@ -579,5 +580,6 @@ resource "google_cloudbuild_trigger" "main_e2e_gemini_enterprise_test" {
579580

580581
substitutions = {
581582
_E2E_DEV_PROJECT = var.e2e_test_project_mapping.dev
583+
_COMMIT_MESSAGE = "$(push.head_commit.message)"
582584
}
583585
}

0 commit comments

Comments
 (0)