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
8 changes: 8 additions & 0 deletions roles/github/templates/prepare-runner.yml.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<%- 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 -%>
Comment on lines +1 to +3

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 -%>

name: %% format_file_name(workflow.file_name, is_title=true) %%

on:
Expand All @@ -9,6 +12,11 @@ on:

jobs:
prepare-runner:
<%- if github_environment_selector == 'input' and (github_registry.share | default(github_default_registry.share)) is false +%>
strategy:
matrix:
environment: %% github_kayobe_environments %%
<%- endif +%>
runs-on: %% github_runs_on %%
container:
image: alpine:latest
Expand Down
Loading