Skip to content

Commit efe7c4b

Browse files
committed
Add workflow to define runner name
1 parent 4032316 commit efe7c4b

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

.github/workflows/runs-on-preq.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Create output for `runs-on` variable
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
runner_env:
8+
description: 'The environment input from caller workflow'
9+
default: 'SMS Lab'
10+
required: True
11+
type: string
12+
outputs:
13+
runner_name_image_build:
14+
description: "Image builder runner name"
15+
value: ${{ jobs.define_runner.outputs.image-build-runner }}
16+
runner_name_aio:
17+
description: "AiO runner name"
18+
value: ${{ jobs.define_runner.outputs.aio-runner }}
19+
20+
jobs:
21+
define_runner:
22+
environment: ${{ inputs.runner_env }}
23+
runs-on: ubuntu-latest
24+
outputs:
25+
image-build-runner: ${{ steps.builder-runner.outputs.runner_name_image_build }}
26+
aio-runner: ${{ steps.aio-runner.outputs.runner_name_aio }}
27+
steps:
28+
- name: Set output for image builder runner
29+
run: echo "Setting runner for ${{ inputs.runner_env }} -> ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}"
30+
- id: builder-runner
31+
run: echo "runner_name_image_build=${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}" >> $GITHUB_OUTPUT
32+
- name: Set output for aio runner
33+
run: echo "Setting runner for ${{ inputs.runner_env }} -> ${{ vars.RUNS_ON_TARGET_AIO }}"
34+
- id: aio-runner
35+
run: echo "runner_name_aio=${{ vars.RUNS_ON_TARGET_AIO }}" >> $GITHUB_OUTPUT
36+

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
generate-tag:
5353
name: Generate container image tag
5454
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
55-
environment: ${{ inputs.runner_env }}
5655
runs-on: ubuntu-latest
5756
permissions: {}
5857
outputs:
@@ -109,22 +108,23 @@ jobs:
109108
run: |
110109
echo "${{ steps.datetime_tag.outputs.datetime_tag }}"
111110
112-
- name: Verify environment
113-
run : |
114-
echo "Environment variable RUNS_ON_TARGET_IMAGE_BUILDER: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}"
111+
runner-preqs:
112+
uses: ./.github/workflows/runs-on-preq.yml
113+
with:
114+
runner_env: ${{ inputs.runner_env }}
115115

116116
container-image-build:
117117
name: Build Kolla container images
118118
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
119-
environment: ${{ inputs.runner_env }}
120-
runs-on: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}
119+
runs-on: ${{ needs.runner-preqs.outputs.runner_name_image_build }}
121120
timeout-minutes: 720
122121
permissions: {}
123122
strategy:
124123
fail-fast: false
125124
matrix: ${{ fromJson(needs.generate-tag.outputs.matrix) }}
126125
needs:
127126
- generate-tag
127+
- runner-preqs
128128
steps:
129129
- name: Install package dependencies
130130
run: |

0 commit comments

Comments
 (0)