99 - main
1010 workflow_dispatch :
1111
12+ env :
13+ QUAY_URI : quay.io/ceph-infra/teuthology-dev
14+ QUAY_TAG : ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
15+
1216jobs :
1317 docker :
1418 runs-on : ${{ matrix.os }}
@@ -20,23 +24,78 @@ jobs:
2024 - os : ubuntu-24.04-arm
2125 python : " 3.12"
2226 steps :
27+ - name : Prepare
28+ run : |
29+ platform=${{ matrix.platform }}
30+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
2331 - name : Checkout
2432 uses : actions/checkout@v4
2533 - name : Login to Quay.io
26- if : github.event_name == 'push' && github.ref_name == 'main'
2734 uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
2835 with :
2936 registry : quay.io
3037 username : ${{ secrets.QUAY_USERNAME }}
3138 password : ${{ secrets.QUAY_ROBOT_TOKEN }}
39+ - name : Docker meta
40+ id : meta
41+ uses : docker/metadata-action@v5
42+ with :
43+ images : ${{ env.REGISTRY_IMAGE }}
3244 - name : Build and push
3345 uses : docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
34- env :
35- QUAY_URI : quay.io/ceph-infra/teuthology-dev
36- QUAY_TAG : ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
3746 with :
47+ platforms : ${{ matrix.platform }}
3848 context : .
3949 file : containers/teuthology-dev/Dockerfile
40- push : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
4150 tags : ${{ env.QUAY_URI }}:${{ env.QUAY_TAG }}
42- outputs : type=image,name=target
51+ labels : ${{ steps.meta.outputs.labels }}
52+ outputs : type=image,name=target,push-by-digest=true,push=true
53+ - name : Export digest
54+ run : |
55+ mkdir -p ${{ runner.temp }}/digests
56+ digest="${{ steps.build.outputs.digest }}"
57+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
58+ - name : Upload digest
59+ uses : actions/upload-artifact@v4
60+ with :
61+ name : digests-${{ env.PLATFORM_PAIR }}
62+ path : ${{ runner.temp }}/digests/*
63+ if-no-files-found : error
64+ retention-days : 1
65+ merge :
66+ runs-on : ubuntu-latest
67+ needs :
68+ - build
69+ steps :
70+ - name : Download digests
71+ uses : actions/download-artifact@v4
72+ with :
73+ path : ${{ runner.temp }}/digests
74+ pattern : digests-*
75+ merge-multiple : true
76+ - name : Login to Quay.io
77+ uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
78+ with :
79+ registry : quay.io
80+ username : ${{ secrets.QUAY_USERNAME }}
81+ password : ${{ secrets.QUAY_ROBOT_TOKEN }}
82+ - name : Set up Docker Buildx
83+ uses : docker/setup-buildx-action@v3
84+ - name : Docker meta
85+ id : meta
86+ uses : docker/metadata-action@v5
87+ with :
88+ images : ${{ env.REGISTRY_IMAGE }}
89+ tags : |
90+ type=ref,event=branch
91+ type=ref,event=pr
92+ type=semver,pattern={{version}}
93+ type=semver,pattern={{major}}.{{minor}}
94+ - name : Create manifest list and push
95+ working-directory : ${{ runner.temp }}/digests
96+ run : |
97+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
98+ $(printf '${{ env.QUAY_URI }}@sha256:%s ' *)
99+ - name : Inspect image
100+ run : |
101+ docker buildx imagetools inspect ${{ env.QUAY_URI }}:${{ steps.meta.outputs.version }}
0 commit comments