@@ -94,18 +94,21 @@ jobs:
9494 # Dynamically define job matrix.
9595 # We need a separate matrix entry for each distribution, when the relevant input is true.
9696 # https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional
97+ # NOTE(bbezak): Both amd64 and aarch64 need to be built in a single workflow to create a multi-architecture manifest.
98+ # For now include only RL9 in aarch64
9799 - name : Generate build matrix
98100 id : set-matrix
99101 run : |
100102 output="{'distro': ["
101103 if [[ ${{ inputs.rocky-linux-9 }} == 'true' ]]; then
102- output+="{'name': 'rocky', 'release': 9},"
104+ output+="{'name': 'rocky', 'release': 9, 'arch': 'amd64'},"
105+ output+="{'name': 'rocky', 'release': 9, 'arch': 'aarch64'},"
103106 fi
104107 if [[ ${{ inputs.ubuntu-jammy }} == 'true' ]]; then
105- output+="{'name': 'ubuntu', 'release': 'jammy'},"
108+ output+="{'name': 'ubuntu', 'release': 'jammy', 'arch': 'amd64' },"
106109 fi
107110 if [[ ${{ inputs.ubuntu-noble }} == 'true' ]]; then
108- output+="{'name': 'ubuntu', 'release': 'noble'},"
111+ output+="{'name': 'ubuntu', 'release': 'noble', 'arch': 'amd64' },"
109112 fi
110113 # remove trailing comma
111114 output="${output%,}"
@@ -124,7 +127,9 @@ jobs:
124127 container-image-build :
125128 name : Build Kolla container images
126129 if : github.repository == 'stackhpc/stackhpc-kayobe-config'
127- runs-on : ${{ needs.runner-selection.outputs.runner_name_container_image_build }}
130+ runs-on : ${{ matrix.distro.arch == 'aarch64'
131+ && fromJson('["self-hosted","sms","arm64"]')
132+ || needs.runner-selection.outputs.runner_name_container_image_build }}
128133 timeout-minutes : 720
129134 permissions : {}
130135 strategy :
@@ -134,19 +139,14 @@ jobs:
134139 - generate-tag
135140 - runner-selection
136141 steps :
142+ - name : Purge workspace
143+ run : sudo rm -rf "$GITHUB_WORKSPACE"/*
144+
137145 - name : Install package dependencies
138146 run : |
139147 sudo apt update
140148 sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv curl jq wget
141149
142- - name : Install gh
143- run : |
144- sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
145- sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
146- echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
147- sudo apt update
148- sudo apt install gh -y
149-
150150 - name : Checkout
151151 uses : actions/checkout@v4
152152 with :
@@ -162,7 +162,8 @@ jobs:
162162
163163 - name : Install yq
164164 run : |
165- curl -sL https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_amd64.tar.gz | tar xz && sudo mv yq_linux_amd64 /usr/bin/yq
165+ ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
166+ curl -sL "https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_${ARCH}.tar.gz" | tar xz && sudo mv yq_linux_${ARCH} /usr/bin/yq
166167
167168 - name : Install Kayobe
168169 run : |
@@ -211,19 +212,28 @@ jobs:
211212 continue-on-error : true
212213 run : |
213214 args="${{ inputs.regexes }}"
215+ if [[ "${{ matrix.distro.arch }}" == 'aarch64' ]]; then
216+ args="$args -e kolla_base_arch=${{ matrix.distro.arch }}"
217+ fi
214218 args="$args -e kolla_base_distro=${{ matrix.distro.name }}"
215219 args="$args -e kolla_base_distro_version=${{ matrix.distro.release }}"
216- args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
220+ if [[ "${{ matrix.distro.name }}" == 'rocky' ]]; then
221+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}-${{ matrix.distro.arch }}"
222+ else
223+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
224+ fi
217225 args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
226+ args="$args -e kolla_build_log_path=$GITHUB_WORKSPACE/image-build-logs/kolla-build-overcloud.log"
227+ args="$args -e base_path=$GITHUB_WORKSPACE/opt/kayobe"
218228 source venvs/kayobe/bin/activate &&
219229 source src/kayobe-config/kayobe-env --environment ci-builder &&
220230 kayobe overcloud container image build $args
221231 env :
222232 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
223233 if : inputs.overcloud
224234
225- - name : Copy overcloud container image build logs to output directory
226- run : sudo mv /var/log/ kolla-build.log image-build-logs/kolla-build-overcloud.log
235+ - name : Copy build configs to output directory
236+ run : sudo cp -rnL "$GITHUB_WORKSPACE/opt/kayobe/etc/ kolla/"* image-build-logs/
227237 if : inputs.overcloud
228238
229239 - name : Build kolla seed images
@@ -239,14 +249,14 @@ jobs:
239249 kayobe seed container image build $args
240250 env :
241251 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
242- if : inputs.seed
252+ if : inputs.seed && matrix.distro.arch == 'amd64'
243253
244254 - name : Copy seed container image build logs to output directory
245255 run : sudo mv /var/log/kolla-build.log image-build-logs/kolla-build-seed.log
246- if : inputs.seed
256+ if : inputs.seed && matrix.distro.arch == 'amd64'
247257
248258 - name : Get built container images
249- run : docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}" > ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images
259+ run : docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}* " > ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images
250260
251261 - name : Fail if no images have been built
252262 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
@@ -307,7 +317,7 @@ jobs:
307317 - name : Upload output artifact
308318 uses : actions/upload-artifact@v4
309319 with :
310- name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-logs
320+ name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-${{ matrix.distro.arch }}- logs
311321 path : image-build-logs
312322 retention-days : 7
313323 if : ${{ !cancelled() }}
@@ -331,6 +341,64 @@ jobs:
331341 run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/critical-images.txt && exit 1; fi
332342 if : ${{ !inputs.push-dirty && !cancelled() }}
333343
344+ - name : Remove locally built images for this run
345+ if : always() && runner.arch == 'ARM64'
346+ run : |
347+ docker images --format '{{.Repository}}:{{.Tag}}' \
348+ --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}*" \
349+ | xargs -r -n1 docker rmi -f
350+
351+ create-manifests :
352+ # Only for Rocky Linux for now
353+ name : Create Multiarch Docker Manifests
354+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && inputs.rocky-linux-9
355+ runs-on : ${{ needs.runner-selection.outputs.runner_name_container_image_build }}
356+ permissions : {}
357+ needs :
358+ - container-image-build
359+ - runner-selection
360+ steps :
361+ - name : Download artifacts
362+ uses : actions/download-artifact@v4
363+
364+ - name : Combine pushed images lists
365+ run : |
366+ find . -name 'push-attempt-images.txt' -exec cat {} + > all-pushed-images.txt
367+
368+ - name : Log in to container registry
369+ uses : docker/login-action@v3
370+ with :
371+ registry : ark.stackhpc.com
372+ username : ${{ secrets.RLS_TRAIN_CI_ARK_REGISTRY_USER }}
373+ password : ${{ secrets.RLS_TRAIN_CI_ARK_REGISTRY_PASS }}
374+
375+ - name : Checkout
376+ uses : actions/checkout@v4
377+ with :
378+ path : src/kayobe-config
379+
380+ - name : Create and push Docker manifests
381+ run : src/kayobe-config/tools/multiarch-manifests.sh
382+
383+ - name : Upload manifest logs
384+ uses : actions/upload-artifact@v4
385+ with :
386+ name : manifest-logs
387+ path : |
388+ all-pushed-images.txt
389+ logs/manifest-creation.log
390+ retention-days : 7
391+ if : ${{ !cancelled() }}
392+
393+ trigger-image-sync :
394+ name : Trigger container image repository sync
395+ needs :
396+ - container-image-build
397+ - create-manifests
398+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && !cancelled()
399+ runs-on : ubuntu-latest
400+ permissions : {}
401+ steps :
334402 # NOTE(mgoddard): Trigger another CI workflow in the
335403 # stackhpc-release-train repository.
336404 - name : Trigger container image repository sync
@@ -347,9 +415,7 @@ jobs:
347415 -f sync-old-images=false
348416 env :
349417 GITHUB_TOKEN : ${{ secrets.STACKHPC_RELEASE_TRAIN_TOKEN }}
350- if : ${{ github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && !cancelled() }}
351418
352419 - name : Display link to container image repository sync workflows
353420 run : |
354421 echo "::notice Container image repository sync workflows: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/container-sync.yml"
355- if : ${{ github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && !cancelled() }}
0 commit comments