- main
workflow_dispatch:
+env:
+ QUAY_URI: quay.io/ceph-infra/teuthology-dev
+ QUAY_TAG: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
+
jobs:
- docker:
- runs-on: ${{ matrix.os }}
+ build:
+ runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- - os: ubuntu-24.04
+ - platform: linux/amd64
+ runner: ubuntu-24.04
python: "3.12"
- - os: ubuntu-24.04-arm
+ - platform: linux/arm64
+ runner: ubuntu-24.04-arm
python: "3.12"
steps:
+ - name: Prepare
+ run: |
+ platform=${{ matrix.platform }}
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Login to Quay.io
- if: github.event_name == 'push' && github.ref_name == 'main'
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
+ with:
+ images: ${{ env.QUAY_URI }}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
- name: Build and push
+ id: build
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
- env:
- QUAY_URI: quay.io/ceph-infra/teuthology-dev
- QUAY_TAG: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
with:
+ platforms: ${{ matrix.platform }}
context: .
file: containers/teuthology-dev/Dockerfile
- push: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- tags: ${{ env.QUAY_URI }}:${{ env.QUAY_TAG }}
- outputs: type=image,name=target
+ # tags: ${{ env.QUAY_URI }}:${{ env.QUAY_TAG }}
+ tags: ${{ env.QUAY_URI }}
+ labels: ${{ steps.meta.outputs.labels }}
+ outputs: type=image,push-by-digest=true,name-canonical=true,push=true
+ - name: Export digest
+ run: |
+ mkdir -p ${{ runner.temp }}/digests
+ digest="${{ steps.build.outputs.digest }}"
+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
+ - name: Upload digest
+ uses: actions/upload-artifact@v4
+ with:
+ name: digests-${{ env.PLATFORM_PAIR }}
+ path: ${{ runner.temp }}/digests/*
+ if-no-files-found: error
+ retention-days: 1
+ merge:
+ runs-on: ubuntu-latest
+ needs:
+ - build
+ steps:
+ - name: Download digests
+ uses: actions/download-artifact@v4
+ with:
+ path: ${{ runner.temp }}/digests
+ pattern: digests-*
+ merge-multiple: true
+ - name: Login to Quay.io
+ uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
+ with:
+ registry: quay.io
+ username: ${{ secrets.QUAY_USERNAME }}
+ password: ${{ secrets.QUAY_ROBOT_TOKEN }}
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
+ with:
+ images: ${{ env.QUAY_URI }}
+ tags: |
+ type=ref,event=branch
+ type=ref,event=pr
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
+ - name: Create manifest list and push
+ working-directory: ${{ runner.temp }}/digests
+ run: |
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
+ $(printf '${{ env.QUAY_URI }}@sha256:%s ' *)
+ - name: Inspect image
+ run: |
+ docker buildx imagetools inspect ${{ env.QUAY_URI }}:${{ steps.meta.outputs.version }}