@@ -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 :
@@ -147,6 +152,10 @@ jobs:
147152 sudo apt update
148153 sudo apt install gh -y
149154
155+ - name : Purge workspace (Arm runner only)
156+ if : runner.arch == 'ARM64'
157+ run : sudo rm -rf "$GITHUB_WORKSPACE"/*
158+
150159 - name : Checkout
151160 uses : actions/checkout@v4
152161 with :
@@ -162,7 +171,8 @@ jobs:
162171
163172 - name : Install yq
164173 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
174+ ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
175+ 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
166176
167177 - name : Install Kayobe
168178 run : |
@@ -211,9 +221,16 @@ jobs:
211221 continue-on-error : true
212222 run : |
213223 args="${{ inputs.regexes }}"
224+ if [[ "${{ matrix.distro.arch }}" == 'aarch64' ]]; then
225+ args="$args -e kolla_base_arch=${{ matrix.distro.arch }}"
226+ fi
214227 args="$args -e kolla_base_distro=${{ matrix.distro.name }}"
215228 args="$args -e kolla_base_distro_version=${{ matrix.distro.release }}"
216- args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
229+ if [[ "${{ matrix.distro.name }}" == 'rocky' ]]; then
230+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}-${{ matrix.distro.arch }}"
231+ else
232+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
233+ fi
217234 args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
218235 source venvs/kayobe/bin/activate &&
219236 source src/kayobe-config/kayobe-env --environment ci-builder &&
@@ -226,6 +243,10 @@ jobs:
226243 run : sudo mv /var/log/kolla-build.log image-build-logs/kolla-build-overcloud.log
227244 if : inputs.overcloud
228245
246+ - name : Copy build configs to output directory
247+ run : sudo cp -rnL /opt/kayobe/etc/kolla/* image-build-logs/
248+ if : inputs.overcloud
249+
229250 - name : Build kolla seed images
230251 id : build_seed_images
231252 continue-on-error : true
@@ -239,14 +260,14 @@ jobs:
239260 kayobe seed container image build $args
240261 env :
241262 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
242- if : inputs.seed
263+ if : inputs.seed && matrix.distro.arch == 'amd64'
243264
244265 - name : Copy seed container image build logs to output directory
245266 run : sudo mv /var/log/kolla-build.log image-build-logs/kolla-build-seed.log
246- if : inputs.seed
267+ if : inputs.seed && matrix.distro.arch == 'amd64'
247268
248269 - 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
270+ 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
250271
251272 - name : Fail if no images have been built
252273 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
@@ -307,7 +328,7 @@ jobs:
307328 - name : Upload output artifact
308329 uses : actions/upload-artifact@v4
309330 with :
310- name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-logs
331+ name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-${{ matrix.distro.arch }}- logs
311332 path : image-build-logs
312333 retention-days : 7
313334 if : ${{ !cancelled() }}
@@ -331,6 +352,124 @@ jobs:
331352 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
332353 if : ${{ !inputs.push-dirty && !cancelled() }}
333354
355+ - name : Remove locally built images for this run
356+ if : always() && runner.arch == 'ARM64'
357+ run : |
358+ docker images --quiet \
359+ --filter "reference=ark.stackhpc.com/stackhpc-dev/*:${{ steps.write-kolla-tag.outputs.kolla-tag }}*" \
360+ | xargs -r docker rmi -f
361+
362+ create-manifests :
363+ # Only for Rocky Linux for now
364+ name : Create Multiarch Docker Manifests
365+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push
366+ runs-on : ${{ needs.runner-selection.outputs.runner_name_container_image_build }}
367+ permissions : {}
368+ needs :
369+ - container-image-build
370+ - runner-selection
371+ steps :
372+ - name : Install package dependencies
373+ run : |
374+ sudo apt update
375+ sudo apt install -y git unzip python3-wheel python3-pip python3-venv curl jq wget openssh-server openssh-client
376+ - name : Install gh
377+ run : |
378+ 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
379+ sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
380+ 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
381+ sudo apt update
382+ sudo apt install gh -y
383+ - name : Checkout Kayobe Config
384+ uses : actions/checkout@v4
385+ with :
386+ path : src/kayobe-config
387+
388+ - name : Install Kayobe
389+ run : |
390+ mkdir -p venvs &&
391+ pushd venvs &&
392+ python3 -m venv kayobe &&
393+ source kayobe/bin/activate &&
394+ pip install -U pip &&
395+ pip install -r ../src/kayobe-config/requirements.txt
396+ # Required for Pulp auth proxy deployment and Docker registry login.
397+ # Normally installed during host configure.
398+ - name : Install Docker Python SDK
399+ run : |
400+ sudo pip install docker
401+ - name : Configure localhost as a seed
402+ run : |
403+ cat > src/kayobe-config/etc/kayobe/environments/ci-builder/inventory/hosts << EOF
404+ # A 'seed' host used for building images.
405+ # Use localhost for container image builds.
406+ [seed]
407+ localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3
408+ EOF
409+ # See etc/kayobe/ansible/roles/pulp_auth_proxy/README.md for details.
410+ # NOTE: We override pulp_auth_proxy_conf_path to a path shared by the
411+ # runner and dind containers.
412+ - name : Deploy an authenticating package repository mirror proxy
413+ run : |
414+ source venvs/kayobe/bin/activate &&
415+ source src/kayobe-config/kayobe-env --environment ci-builder &&
416+ kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/pulp-auth-proxy.yml -e pulp_auth_proxy_conf_path=/home/runner/_work/pulp_proxy
417+ env :
418+ KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
419+
420+ - name : Download artifacts
421+ uses : actions/download-artifact@v4
422+
423+ - name : Combine pushed images lists
424+ run : |
425+ find . -name 'push-attempt-images.txt' -exec cat {} + > all-pushed-images.txt
426+ - name : Log in to Docker registry
427+ run : |
428+ source venvs/kayobe/bin/activate &&
429+ source src/kayobe-config/kayobe-env --environment ci-builder &&
430+ kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml
431+ env :
432+ KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
433+
434+ - name : Create and Push Docker Manifests
435+ run : |
436+ set -ex
437+ mkdir -p logs
438+ images=$(cat all-pushed-images.txt | sort | uniq)
439+ # Filter out Ubuntu and Rocky Bifrost images
440+ manifest_images=$(echo "$images" | grep -E '.*-(amd64|aarch64)$' | sed -E 's/-(amd64|aarch64)$//' | sort | uniq)
441+ if [ -z "$manifest_images" ]; then
442+ echo "No Rocky overcloud images found. Skipping manifest creation." | tee -a logs/manifest-creation.log
443+ exit 0
444+ fi
445+ for base_image in $manifest_images; do
446+ arch_images=""
447+ for arch in amd64 aarch64; do
448+ arch_image="${base_image}-${arch}"
449+ # Check if the image exists in the registry
450+ if docker manifest inspect "$arch_image" > /dev/null 2>&1; then
451+ arch_images="$arch_images $arch_image"
452+ fi
453+ done
454+ if [ -n "$arch_images" ]; then
455+ echo "Creating manifest for $base_image with images:$arch_images" | tee -a logs/manifest-creation.log
456+ docker manifest create "$base_image" $arch_images | tee -a logs/manifest-creation.log
457+ docker manifest push "$base_image" | tee -a logs/manifest-creation.log
458+ else
459+ echo "No images found for $base_image, skipping." | tee -a logs/manifest-creation.log
460+ fi
461+ done
462+
463+ - name : Upload manifest logs
464+ uses : actions/upload-artifact@v4
465+ with :
466+ name : manifest-logs
467+ path : |
468+ all-pushed-images.txt
469+ logs/manifest-creation.log
470+ retention-days : 7
471+ if : ${{ !cancelled() }}
472+
334473 # NOTE(mgoddard): Trigger another CI workflow in the
335474 # stackhpc-release-train repository.
336475 - name : Trigger container image repository sync
0 commit comments