@@ -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%,}"
@@ -211,9 +214,16 @@ jobs:
211214 continue-on-error : true
212215 run : |
213216 args="${{ inputs.regexes }}"
217+ if [[ "${{ matrix.distro.arch }}" == 'aarch64' ]]; then
218+ args="$args -e kolla_base_arch=${{ matrix.distro.arch }}"
219+ fi
214220 args="$args -e kolla_base_distro=${{ matrix.distro.name }}"
215221 args="$args -e kolla_base_distro_version=${{ matrix.distro.release }}"
216- args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
222+ if [[ "${{ matrix.distro.name }}" == 'rocky' ]]; then
223+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}-${{ matrix.distro.arch }}"
224+ else
225+ args="$args -e kolla_tag=${{ steps.write-kolla-tag.outputs.kolla-tag }}"
226+ fi
217227 args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
218228 source venvs/kayobe/bin/activate &&
219229 source src/kayobe-config/kayobe-env --environment ci-builder &&
@@ -226,6 +236,10 @@ jobs:
226236 run : sudo mv /var/log/kolla-build.log image-build-logs/kolla-build-overcloud.log
227237 if : inputs.overcloud
228238
239+ - name : Copy build configs to output directory
240+ run : sudo cp -rnL /opt/kayobe/etc/kolla/* image-build-logs/
241+ if : inputs.overcloud
242+
229243 - name : Build kolla seed images
230244 id : build_seed_images
231245 continue-on-error : true
@@ -239,14 +253,14 @@ jobs:
239253 kayobe seed container image build $args
240254 env :
241255 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
242- if : inputs.seed
256+ if : inputs.seed && matrix.distro.arch == 'amd64'
243257
244258 - name : Copy seed container image build logs to output directory
245259 run : sudo mv /var/log/kolla-build.log image-build-logs/kolla-build-seed.log
246- if : inputs.seed
260+ if : inputs.seed && matrix.distro.arch == 'amd64'
247261
248262 - 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
263+ 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
250264
251265 - name : Fail if no images have been built
252266 run : if [ $(wc -l < ${{ matrix.distro.name }}-${{ matrix.distro.release }}-container-images) -le 1 ]; then exit 1; fi
@@ -307,7 +321,7 @@ jobs:
307321 - name : Upload output artifact
308322 uses : actions/upload-artifact@v4
309323 with :
310- name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-logs
324+ name : ${{ matrix.distro.name }}-${{ matrix.distro.release }}-${{ matrix.distro.arch }}- logs
311325 path : image-build-logs
312326 retention-days : 7
313327 if : ${{ !cancelled() }}
@@ -331,6 +345,116 @@ jobs:
331345 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
332346 if : ${{ !inputs.push-dirty && !cancelled() }}
333347
348+ create-manifests :
349+ # Only for Rocky Linux for now
350+ name : Create Multiarch Docker Manifests
351+ if : github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push
352+ runs-on : arc-skc-container-image-builder-runner
353+ permissions : {}
354+ needs :
355+ - container-image-build
356+ steps :
357+ - name : Install package dependencies
358+ run : |
359+ sudo apt update
360+ sudo apt install -y git unzip python3-wheel python3-pip python3-venv curl jq wget openssh-server openssh-client
361+ - name : Install gh
362+ run : |
363+ 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
364+ sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
365+ 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
366+ sudo apt update
367+ sudo apt install gh -y
368+ - name : Checkout Kayobe Config
369+ uses : actions/checkout@v4
370+ with :
371+ path : src/kayobe-config
372+
373+ - name : Install Kayobe
374+ run : |
375+ mkdir -p venvs &&
376+ pushd venvs &&
377+ python3 -m venv kayobe &&
378+ source kayobe/bin/activate &&
379+ pip install -U pip &&
380+ pip install -r ../src/kayobe-config/requirements.txt
381+ # Required for Pulp auth proxy deployment and Docker registry login.
382+ # Normally installed during host configure.
383+ - name : Install Docker Python SDK
384+ run : |
385+ sudo pip install docker
386+ - name : Configure localhost as a seed
387+ run : |
388+ cat > src/kayobe-config/etc/kayobe/environments/ci-builder/inventory/hosts << EOF
389+ # A 'seed' host used for building images.
390+ # Use localhost for container image builds.
391+ [seed]
392+ localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3
393+ EOF
394+ # See etc/kayobe/ansible/roles/pulp_auth_proxy/README.md for details.
395+ # NOTE: We override pulp_auth_proxy_conf_path to a path shared by the
396+ # runner and dind containers.
397+ - name : Deploy an authenticating package repository mirror proxy
398+ run : |
399+ source venvs/kayobe/bin/activate &&
400+ source src/kayobe-config/kayobe-env --environment ci-builder &&
401+ kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/pulp-auth-proxy.yml -e pulp_auth_proxy_conf_path=/home/runner/_work/pulp_proxy
402+ env :
403+ KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
404+
405+ - name : Download artifacts
406+ uses : actions/download-artifact@v4
407+
408+ - name : Combine pushed images lists
409+ run : |
410+ find . -name 'push-attempt-images.txt' -exec cat {} + > all-pushed-images.txt
411+ - name : Log in to Docker registry
412+ run : |
413+ source venvs/kayobe/bin/activate &&
414+ source src/kayobe-config/kayobe-env --environment ci-builder &&
415+ kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml
416+ env :
417+ KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
418+
419+ - name : Create and Push Docker Manifests
420+ run : |
421+ set -ex
422+ mkdir -p logs
423+ images=$(cat all-pushed-images.txt | sort | uniq)
424+ # Filter out Ubuntu and Rocky Bifrost images
425+ manifest_images=$(echo "$images" | grep -E '.*-(amd64|aarch64)$' | sed -E 's/-(amd64|aarch64)$//' | sort | uniq)
426+ if [ -z "$manifest_images" ]; then
427+ echo "No Rocky overcloud images found. Skipping manifest creation." | tee -a logs/manifest-creation.log
428+ exit 0
429+ fi
430+ for base_image in $manifest_images; do
431+ arch_images=""
432+ for arch in amd64 aarch64; do
433+ arch_image="${base_image}-${arch}"
434+ # Check if the image exists in the registry
435+ if docker manifest inspect "$arch_image" > /dev/null 2>&1; then
436+ arch_images="$arch_images $arch_image"
437+ fi
438+ done
439+ if [ -n "$arch_images" ]; then
440+ echo "Creating manifest for $base_image with images:$arch_images" | tee -a logs/manifest-creation.log
441+ docker manifest create "$base_image" $arch_images | tee -a logs/manifest-creation.log
442+ docker manifest push "$base_image" | tee -a logs/manifest-creation.log
443+ else
444+ echo "No images found for $base_image, skipping." | tee -a logs/manifest-creation.log
445+ fi
446+ done
447+
448+ - name : Upload manifest logs
449+ uses : actions/upload-artifact@v4
450+ with :
451+ name : manifest-logs
452+ path : |
453+ all-pushed-images.txt
454+ logs/manifest-creation.log
455+ retention-days : 7
456+ if : ${{ !cancelled() }}
457+
334458 # NOTE(mgoddard): Trigger another CI workflow in the
335459 # stackhpc-release-train repository.
336460 - name : Trigger container image repository sync
0 commit comments