Skip to content

Commit 0a5eede

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

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-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: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ env:
5050
ANSIBLE_FORCE_COLOR: True
5151
jobs:
5252
generate-tag:
53+
environment: ${{ inputs.runner_env }}
5354
name: Generate container image tag
5455
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
55-
environment: ${{ inputs.runner_env }}
5656
runs-on: ubuntu-latest
5757
permissions: {}
5858
outputs:
@@ -109,22 +109,24 @@ jobs:
109109
run: |
110110
echo "${{ steps.datetime_tag.outputs.datetime_tag }}"
111111
112-
- name: Verify environment
113-
run : |
114-
echo "Environment variable RUNS_ON_TARGET_IMAGE_BUILDER: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}"
112+
runner-preqs:
113+
uses: ./.github/workflows/runs-on-preq.yml
114+
with:
115+
runner_env: ${{ inputs.runner_env }}
115116

116117
container-image-build:
118+
environment: ${{ inputs.runner_env }}
117119
name: Build Kolla container images
118120
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
119-
environment: ${{ inputs.runner_env }}
120-
runs-on: ${{ vars.RUNS_ON_TARGET_IMAGE_BUILDER }}
121+
runs-on: ${{ needs.runner-preqs.outputs.runner_name_image_build }}
121122
timeout-minutes: 720
122123
permissions: {}
123124
strategy:
124125
fail-fast: false
125126
matrix: ${{ fromJson(needs.generate-tag.outputs.matrix) }}
126127
needs:
127128
- generate-tag
129+
- runner-preqs
128130
steps:
129131
- name: Install package dependencies
130132
run: |
@@ -144,6 +146,10 @@ jobs:
144146
with:
145147
path: src/kayobe-config
146148

149+
- name: Print user
150+
run: |
151+
whoami
152+
147153
- name: Make sure dockerd is running and test Docker
148154
run: |
149155
docker ps

0 commit comments

Comments
 (0)