Skip to content

Conversation

@clincoln8
Copy link
Contributor

@clincoln8 clincoln8 commented Jan 21, 2026

The current script is failing to deploy when dev or dev_website is deployed with an unsubmitted githash.

This change:

  1. Adds a || true to the HTML fallback grep check for commit hash to delay pipefail exiting so that the more detailed error message is printed in the logs.
  2. Skips the validation for dev and dev_website if the deployed hash is unsubmitted and logs a warning.
    • Updates the HTML commit parsing to be more accepting so that the warning message is more helpful.

Testing

Executed the script, abbreviated output contains:

[~/datcom-mixer]:$ ./scripts/check_flags.sh deploy/featureflags --live
LIVE: Checking flags against mixer server at the current live commit for each env.
Checking feature flag parsing for all envs in /Users/calinc/datcom-mixer/deploy/featureflags...
Checking live commit for staging...
Fetching live commit from https://staging.api.datacommons.org/version
Checking out live commit for staging: 075da6c
...
Checking live commit for dev_website...
Fetching live commit from https://dev.datacommons.org/version
Warning: Live commit 'latest' not found locally. Skipping live compatibility check for dev_website.
Checking live commit for prod_website...
Fetching live commit from https://datacommons.org/version
Checking out live commit for prod_website: 0ec0fba
...
Checking live commit for dev...
Fetching live commit from https://dev.api.datacommons.org/version
Warning: Live commit 'latest' not found locally. Skipping live compatibility check for dev.
Checking live commit for autopush_website...
Fetching live commit from https://autopush.datacommons.org/version
Checking out live commit for autopush_website: 075da6c
...
Checking live commit for staging_website...
Fetching live commit from https://staging.datacommons.org/version
Checking out live commit for staging_website: 0ec0fba
...
Checking live commit for autopush...
Fetching live commit from https://autopush.api.datacommons.org/version
Checking out live commit for autopush: 075da6c
...
Checking live commit for local...
Warning: No liveUrl found for local, skipping live commit check.
Checking live commit for prod...
Fetching live commit from https://api.datacommons.org/version
Checking out live commit for prod: 0ec0fba

@clincoln8 clincoln8 requested a review from n-h-diaz January 21, 2026 05:31
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @clincoln8, 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 addresses a critical deployment issue where the check_flags.sh script would prematurely fail for dev and dev_website environments when encountering an unsubmitted or locally unavailable commit hash. The changes enhance the script's robustness by refining error message output, making commit hash parsing more fault-tolerant, and implementing a conditional bypass for live compatibility checks in specific development environments. This ensures that deployments to dev and dev_website can proceed with appropriate warnings, rather than being blocked by non-critical commit validation failures.

Highlights

  • Improved Error Handling: Error messages for missing dependencies are now redirected to standard error, ensuring better separation of error output from regular script output.
  • Robust Commit Hash Extraction: The script's logic for extracting commit hashes has been made more resilient. It now prevents premature script termination due to parsing errors from yq or grep by using || true, and the HTML fallback regex has been broadened to accommodate a wider range of commit hash formats.
  • Environment-Specific Bypass for Live Checks: For dev and dev_website environments, the script will now bypass the local commit existence validation if the deployed commit hash is not found locally. Instead of failing, it will log a warning, allowing deployments to proceed in these specific development contexts.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the check_flags.sh script to handle deployments with unsubmitted git hashes for dev and dev_website environments, bypassing the live commit check if the commit is not found locally. While the script improves error message redirection to stderr and makes commit hash parsing more robust, a critical security vulnerability has been identified. The expanded regex for commit hash extraction introduces a potential argument injection vulnerability in subsequent git commands, allowing an attacker to inject git options and cause unexpected script behavior. It is strongly recommended to use the -- separator in all git commands to safely handle external input. Additionally, there is one suggestion to improve the code's conciseness and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant