feat: skip E2E tests for dependency update commits#710
Conversation
- 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
Summary of ChangesHello @eliasecchig, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces an efficiency improvement to the CI/CD pipeline by enabling conditional skipping of End-to-End (E2E) and Gemini Enterprise tests. Specifically, if a commit message begins with 'build(deps)', indicating an automated dependency update, the associated test stages will be bypassed. This optimization is achieved by integrating the commit message as a build substitution variable and implementing skip logic within the Cloud Build configurations, ultimately leading to reduced CI costs and faster feedback cycles for relevant changes. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a useful optimization to skip E2E and Gemini Enterprise tests for dependency update commits, which will help reduce CI costs. The implementation correctly uses Cloud Build payload bindings to get the commit message and a sentinel file to control step execution. The changes are logical and well-implemented. I have one suggestion to improve the maintainability of one of the Cloud Build configuration files by reducing code duplication.
| if [ -f /workspace/.skip-e2e ]; then | ||
| echo "Skipping - dependency update commit" | ||
| exit 0 | ||
| fi |
There was a problem hiding this comment.
This skip logic is repeated in two other steps within this file (lines 51-54 and 64-67). This duplication can make the configuration harder to maintain in the long run.
To improve this, you could use a YAML anchor to define the script block once and then reuse it in each step. This follows the DRY (Don't Repeat Yourself) principle.
For example, you could define an anchor at the top of the file:
x-skip-check: &skip-check |
if [ -f /workspace/.skip-e2e ]; then
echo "Skipping step due to dependency update commit."
exit 0
fiAnd then apply it in each relevant step:
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
id: set-gcloud-project
entrypoint: /bin/bash
args:
- "-c"
- |
<<: *skip-check
gcloud config set project ${_E2E_DEV_PROJECT}…rm#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
Summary
build(deps)Changes
_COMMIT_MESSAGE = "$(push.head_commit.message)"substitution to E2E triggerstest_e2e.yamlto check commit message and skip if dependency updatetest_gemini_enterprise.yamlwith same skip logic