Skip to content

Commit 73a9a61

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

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
steps:
25+
- name: Set output for image builder runner
26+
run: echo "Setting runner for ${{ inputs.runner_env }} -> ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}"
27+
28+
- name: Set output for aio runner
29+
run: echo "Setting runner for ${{ inputs.runner_env }} -> ${{ vars.RUNS_ON_TARGET_AIO }}"
30+
31+
outputs:
32+
image-build-runner: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}
33+
aio-runner: ${{ vars.RUNS_ON_TARGET_AIO }}

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,28 @@ jobs:
113113
run : |
114114
echo "Environment variable RUNS_ON_TARGET_IMAGE_BUILDER: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}"
115115
116+
117+
runner-preqs:
118+
uses: ./.github/workflows/runs-on-preq.yml
119+
with:
120+
runner_env: ${{ inputs.runner_env }}
121+
122+
# runner-preqs:
123+
# name: Generate runs-on target based on environment
124+
# runs-on: ubuntu-latest
125+
# steps:
126+
# - name: Checkout
127+
# uses: actions/checkout@v4
128+
# # This is because there is a bug where the runs-on target cannot be dynamically set using environment variables.
129+
# - name: Call setup workflow
130+
# uses: ./.github/workflows/runs-on-preq.yml
131+
132+
116133
container-image-build:
117134
name: Build Kolla container images
118135
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
119136
environment: ${{ inputs.runner_env }}
120-
runs-on: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}
137+
runs-on: ${{ needs.generate-tag.outputs.runner_name_image_build }}
121138
timeout-minutes: 720
122139
permissions: {}
123140
strategy:

0 commit comments

Comments
 (0)