diff --git a/.gitea/workflows/redhat_build.yml b/.gitea/workflows/redhat_build.yml index 46d5ca7..abd6be3 100644 --- a/.gitea/workflows/redhat_build.yml +++ b/.gitea/workflows/redhat_build.yml @@ -1,3 +1,4 @@ +```yaml name: Build container image on: @@ -145,6 +146,32 @@ jobs: outputs: type=oci,dest=${{ github.workspace }}/oci-layout.tar,tar=true + # ------------------------------------------------------------ + # Inspect OCI archive + # ------------------------------------------------------------ + + - name: Inspect OCI archive + if: github.event_name != 'pull_request' + run: | + set -euo pipefail + + echo "OCI archive:" + ls -lh "${{ github.workspace }}/oci-layout.tar" + + echo + echo "OCI index.json:" + tar -xf "${{ github.workspace }}/oci-layout.tar" \ + -O index.json | jq . + + echo + echo "OCI image references:" + tar -xf "${{ github.workspace }}/oci-layout.tar" \ + -O index.json \ + | jq -r ' + .manifests[] + | .annotations["org.opencontainers.image.ref.name"] // "(no ref.name)" + ' + # ------------------------------------------------------------ # Install Skopeo # ------------------------------------------------------------ @@ -156,24 +183,34 @@ jobs: sudo apt-get install -y skopeo # ------------------------------------------------------------ - # Push image via Skopeo + # Push images via Skopeo # ------------------------------------------------------------ - - name: Push Image via Skopeo (zstd:chunked) + - name: Push Images via Skopeo (zstd:chunked) if: github.event_name != 'pull_request' run: | - set -e + set -euo pipefail + OCI_ARCHIVE="${{ github.workspace }}/oci-layout.tar" TAGS="${{ steps.metadata.outputs.tags }}" - for TAG in $TAGS; do - echo "Pushe ${TAG} via Skopeo mit zstd:chunked..." + echo "Images to push:" + echo "${TAGS}" + + for DEST_TAG in ${TAGS}; do + SOURCE_TAG="${DEST_TAG##*:}" + + echo + echo "============================================================" + echo "Source OCI tag : ${SOURCE_TAG}" + echo "Destination : ${DEST_TAG}" + echo "============================================================" skopeo copy \ --dest-creds "${{ github.repository_owner }}:${{ secrets.REGISTRY }}" \ --dest-compress-format zstd:chunked \ - "oci-archive:${{ github.workspace }}/oci-layout.tar" \ - "docker://${TAG}" + "oci-archive:${OCI_ARCHIVE}:${SOURCE_TAG}" \ + "docker://${DEST_TAG}" done # ------------------------------------------------------------ @@ -204,7 +241,7 @@ jobs: COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} COSIGN_PASSWORD: "" run: | - set -e + set -euo pipefail echo "${{ secrets.REGISTRY }}" \ | cosign login "${{ env.REGISTRY_HOST }}" \ @@ -246,4 +283,5 @@ jobs: rm -f "${{ github.workspace }}/oci-layout.tar" - docker buildx prune -a -f || true \ No newline at end of file + docker buildx prune -a -f || true +```