Skip to content

Conversation

hqpho
Copy link
Contributor

@hqpho hqpho commented Oct 3, 2025

No description provided.

Copy link

Summary of Changes

Hello @hqpho, 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 a robust mechanism for managing and controlling feature flag deployments, particularly for production environments. It integrates a new pre-merge check into the CI pipeline that strictly enforces time-based restrictions on changes to production feature flag configurations, ensuring that such critical updates occur during monitored business hours. Additionally, it establishes a structured approach to defining feature flags across various environments by introducing dedicated configuration files.

Highlights

  • CI/CD Pre-Merge Checks: A new Cloud Build step, enforce-feature-flag-merge-restrictions, has been added to cloudbuild.merge_test.yaml. This step executes a bash script to validate changes before merging, specifically targeting feature flag configurations.
  • Production Feature Flag Restrictions: A new script, enforce_merge_restrictions.sh, has been introduced to prevent merging changes to production feature flag YAML files (prod*.yaml) outside of specific business hours (Monday-Thursday, 9 AM - 5 PM PT). This enhances control over critical production deployments.
  • Centralized Feature Flag Configurations: Dedicated YAML files (autopush_website.yaml, dev_website.yaml, prod_website.yaml, staging_website.yaml) have been added to centralize and define feature flag settings for different deployment environments, promoting consistency and easier management.
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

@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 introduces configuration files for feature flags across different environments and adds a CI check to enforce merge restrictions on production configurations. My review focuses on the new CI script and its configuration. I've found a few critical issues in the shell script and its invocation that would cause the CI check to fail incorrectly. There's also a recommendation to make the file matching logic more robust.


if [[ -z "$MODIFIED_PROD_FILES" ]]; then
echo "No modified 'prod' feature flag files found. No restrictions apply."
exit 1

Choose a reason for hiding this comment

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

critical

The script exits with status 1 when no modified 'prod' feature flag files are found. This is incorrect behavior for a CI check, as it will cause the build to fail when it should pass. The script should exit with status 0 to indicate success in this case.

Suggested change
exit 1
exit 0

fi

echo "Production change is within the allowed time window. Checks passed."
exit 1

Choose a reason for hiding this comment

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

critical

The script exits with status 1 after all checks have passed successfully. This will cause the CI step to fail unexpectedly. The script should exit with status 0 to indicate a successful run.

Suggested change
exit 1
exit 0


# Get the list of modified YAML files containing "prod" in their name within the config directory.
# This compares the current temporary merge commit (HEAD) with the target branch.
MODIFIED_PROD_FILES=$(git diff --name-only "$(git merge-base HEAD "$BASE_BRANCH")" HEAD -- "$CONFIG_DIR" | grep 'prod.*\.yaml$' || true)

Choose a reason for hiding this comment

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

medium

The grep pattern prod.*\.yaml$ is too broad and could cause false positives by matching files that contain "prod" but are not production environment configurations (e.g., a file named reproduction.yaml). To avoid this, consider using a more specific pattern that matches the naming convention of your production config files, such as files starting with prod_.

Suggested change
MODIFIED_PROD_FILES=$(git diff --name-only "$(git merge-base HEAD "$BASE_BRANCH")" HEAD -- "$CONFIG_DIR" | grep 'prod.*\.yaml$' || true)
MODIFIED_PROD_FILES=$(git diff --name-only "$(git merge-base HEAD "$BASE_BRANCH")" HEAD -- "$CONFIG_DIR" | grep 'prod_.*\.yaml$' || true)

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