Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions roles/github/templates/build-kayobe-docker-image.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ name: %% format_file_name(workflow.file_name, is_title=true) %%

on:
workflow_dispatch:
<%- if github_environment_selector == 'input' and (github_registry.share | default(github_default_registry.share)) is false +%>
inputs:
kayobe_environment:
description: |
Select the environment the kayobe workflow shall target.
type: choice
options: %% github_kayobe_environments %%
Comment on lines +12 to +17

Choose a reason for hiding this comment

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

high

There are a couple of issues with the current implementation of the workflow input.

  1. Input should be required and have a default value: The kayobe_environment input should be marked as required: true to ensure a value is always provided by the user. It's also good practice to provide a default value, typically the first environment in the list. This prevents the workflow from running with an empty string if the user doesn't make a selection, which would cause failures later on.

  2. Matrix strategy ignores input: The job's matrix strategy (on line 32) is configured to iterate over all github_kayobe_environments, ignoring the environment selected via the new workflow_dispatch input. This means that even if a user selects a single environment, the job will run for all of them.

To fix this, you should update the inputs block as suggested below, and also modify the strategy.matrix.environment on line 32 to be ['${{ inputs.kayobe_environment }}']. This will ensure the job runs only for the environment selected by the user.

    inputs:
      kayobe_environment:
        description: |
          Select the environment the kayobe workflow shall target.
        type: choice
        required: true
        default: %% github_kayobe_environments | first %%
        options: %% github_kayobe_environments %%

<%- endif +%>


env:
KAYOBE_USER_UID: %% github_kayobe_user_id %%
Expand Down
Loading