Reuse packages and methods used in Velero CLI for OADP CLI #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Push binaries to Quay.io, when a new release is created | |
| name: Multi-Arch Binary Push to Quay.io | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| env: | |
| IMAGE_REPO: quay.io/konveyor/oadp-cli-binaries | |
| jobs: | |
| multi-arch-build: | |
| name: Build Multi-Arch Images | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64, ppc64le, s390x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build Image for ${{ matrix.arch }} | |
| id: build_image | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| image: oadp-cli-binaries-local | |
| tags: ${{ matrix.arch }} | |
| archs: ${{ matrix.arch }} | |
| build-args: | | |
| TARGETOS=linux | |
| TARGETARCH=${{ matrix.arch }} | |
| containerfiles: | | |
| ./Containerfile.download | |
| - name: Save image as tar | |
| run: | | |
| buildah push ${{ steps.build_image.outputs.image-with-tag }} oci-archive:oadp-cli-${{ matrix.arch }}.tar | |
| - name: Upload image artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: oadp-cli-image-${{ matrix.arch }} | |
| path: oadp-cli-${{ matrix.arch }}.tar | |
| retention-days: 1 | |
| push-manifest: | |
| name: Create and Push Multi-Arch Manifest | |
| runs-on: ubuntu-latest | |
| needs: multi-arch-build | |
| if: startsWith(github.ref_name, 'v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: oadp-cli-image-* | |
| - name: Buildah login | |
| run: buildah login -u ${{ secrets.QUAY_USER }} -p ${{ secrets.QUAY_TOKEN }} quay.io | |
| - name: Load images and tag archs | |
| run: | | |
| # Load all arch images and capture their IDs | |
| AMD64_ID=$(buildah pull oci-archive:oadp-cli-image-amd64/oadp-cli-amd64.tar) | |
| ARM64_ID=$(buildah pull oci-archive:oadp-cli-image-arm64/oadp-cli-arm64.tar) | |
| PPC64LE_ID=$(buildah pull oci-archive:oadp-cli-image-ppc64le/oadp-cli-ppc64le.tar) | |
| S390X_ID=$(buildah pull oci-archive:oadp-cli-image-s390x/oadp-cli-s390x.tar) | |
| # Tag the loaded images using their IDs | |
| buildah tag $AMD64_ID ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-amd64 | |
| buildah tag $ARM64_ID ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-arm64 | |
| buildah tag $PPC64LE_ID ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-ppc64le | |
| buildah tag $S390X_ID ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-s390x | |
| - name: Create and push multi-arch manifest (version tag) | |
| run: | | |
| buildah manifest create ${{ env.IMAGE_REPO }}:${{ github.ref_name }} | |
| buildah manifest add ${{ env.IMAGE_REPO }}:${{ github.ref_name }} ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-amd64 | |
| buildah manifest add ${{ env.IMAGE_REPO }}:${{ github.ref_name }} ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-arm64 | |
| buildah manifest add ${{ env.IMAGE_REPO }}:${{ github.ref_name }} ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-ppc64le | |
| buildah manifest add ${{ env.IMAGE_REPO }}:${{ github.ref_name }} ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-s390x | |
| buildah manifest push --all ${{ env.IMAGE_REPO }}:${{ github.ref_name }} | |
| - name: Create and push multi-arch manifest (latest tag) | |
| run: | | |
| buildah manifest create ${{ env.IMAGE_REPO }}:latest | |
| buildah manifest add ${{ env.IMAGE_REPO }}:latest ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-amd64 | |
| buildah manifest add ${{ env.IMAGE_REPO }}:latest ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-arm64 | |
| buildah manifest add ${{ env.IMAGE_REPO }}:latest ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-ppc64le | |
| buildah manifest add ${{ env.IMAGE_REPO }}:latest ${{ env.IMAGE_REPO }}:${{ github.ref_name }}-s390x | |
| buildah manifest push --all ${{ env.IMAGE_REPO }}:latest |