From 0a0a7befb4b90b67643c3b2a87e03f80c35bdcf1 Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Thu, 12 Dec 2024 10:49:48 +0100 Subject: [PATCH] Create a index manifest for the target repo (#1245) * Create a index manifest for the target repo * show progress --- .github/workflows/build-push.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index d4228c6fb..242e9f953 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -171,10 +171,26 @@ jobs: linux/amd64 linux/arm64 - - name: Copy image - run: docker buildx imagetools create -t ${{ steps.metadata.outputs.operator }} ${{ needs.build-operator.outputs.fullname }} - - name: Copy image - run: docker buildx imagetools create -t ${{ steps.metadata.outputs.pipeline }} ${{ needs.build-pipelinerunner.outputs.fullname }} + # This steps reads the original manifest, + # fetches all the digests from the manifest, + # and builds a new for the target repository + - name: Copy Operator image + env: + TARGETREPO: ${{ steps.metadata.outputs.operator }} + SOURCERPO: ${{ needs.build-operator.outputs.fullname }} + run: | + docker buildx imagetools inspect $SOURCEREPO --raw > manifest.json + tags=$(jq '[.manifests[] | env.SOURCEREPO + "@" + .digest] | join(" ")' -r manifest.json) + echo $tags | xargs docker buildx imagetools create --progress=plain --tag $TARGETREPO + + - name: Copy Pipeline Runner image + env: + TARGETREPO: ${{ steps.metadata.outputs.pipeline }} + SOURCERPO: ${{ needs.build-pipelinerunner.outputs.fullname }} + run: | + docker buildx imagetools inspect $SOURCEREPO --raw > manifest.json + tags=$(jq '[.manifests[] | env.SOURCEREPO + "@" + .digest] | join(" ")' -r manifest.json) + echo $tags | xargs docker buildx imagetools create --progress=plain --tag $TARGETREPO - name: Revoke GitHub IP on ACR if: ${{ steps.update_firewall.outcome == 'success' && !cancelled()}} # Always run this step even if previous step failed