Skip to content

Conversation

@darmach
Copy link
Member

@darmach darmach commented Nov 26, 2025

This change corrects prepare runner playbook being not aware of running environment when we use input environment selector.

This change corrects prepare runner playbook being not aware of running environment when we use input environment selector.
@darmach darmach requested a review from a team as a code owner November 26, 2025 12:46
@gemini-code-assist
Copy link

Summary of Changes

Hello @darmach, 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 oversight in the prepare runner playbook, ensuring it correctly identifies and utilizes the specified execution environment. By conditionally appending the environment matrix variable to the runner's configuration, the change guarantees that workflows run in the intended isolated environments when an input selector is used and registry sharing is not active.

Highlights

  • Environment Awareness Fix: Corrected an issue where the prepare runner playbook was not properly recognizing the running environment when an 'input' environment selector was in use.
  • Dynamic Runner Configuration: Implemented a conditional logic to dynamically add the ${{ matrix.environment }} variable to the github_runs_on list. This ensures the runner is correctly configured for the selected environment when using an 'input' selector and registry sharing is disabled.
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.

@darmach darmach marked this pull request as draft November 26, 2025 12:47
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 aims to make the prepare-runner workflow aware of the selected environment by adding logic to append an environment-specific runner label. However, the current implementation incorrectly uses ${{ matrix.environment }} in a context where no matrix strategy is defined for the job, which will cause the workflow to fail. I have provided a critical-severity comment with a suggested correction to use a workflow input instead, and have outlined the other necessary changes to fully implement this feature.

Comment on lines +1 to +3
<%- if github_environment_selector == 'input' and (github_registry.share | default(github_default_registry.share)) is false -%>
<%- set github_runs_on = github_runs_on + ['${{ matrix.environment }}'] -%>
<%- endif -%>

Choose a reason for hiding this comment

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

critical

The use of ${{ matrix.environment }} on line 2 is incorrect because the prepare-runner job within this reusable workflow does not have a strategy.matrix defined. This will cause the workflow to fail because the matrix context is not available.

Given the intent to use the environment from a workflow input, you should use an input variable. To achieve this, you'll need to:

  1. Declare kayobe_environment as a workflow_call input in this file.
  2. Pass the input from the calling workflow (likely in generic.yml.j2).
  3. Use ${{ inputs.kayobe_environment }} here instead of ${{ matrix.environment }}.

This suggestion corrects the variable, assuming the necessary changes to pass the input will also be made.

<%- if github_environment_selector == 'input' and (github_registry.share | default(github_default_registry.share)) is false -%>
<%- set github_runs_on = github_runs_on + ['${{ inputs.kayobe_environment }}'] -%>
<%- endif -%>

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.

2 participants