fix: replace Skopeo push with redhat-actions/push-to-registry
Avoids double compression (chunkah zstd + Skopeo zstd:chunked). push-to-registry handles auth and multi-tag push natively.
This commit is contained in:
+12
-21
@@ -127,29 +127,20 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# OPTIMIERUNG 2: Skopeo zwingen, die Layer intelligent zu zerteilen
|
- name: Push to GHCR
|
||||||
- name: Push to GHCR via Skopeo (with intelligent zstd:chunked rechunking)
|
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
||||||
|
uses: redhat-actions/push-to-registry@v2
|
||||||
|
with:
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
|
registry: ${{ env.IMAGE_REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get registry digest
|
||||||
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
||||||
run: |
|
run: |
|
||||||
set -x
|
FINAL_REGISTRY_DIGEST=$(skopeo inspect docker://${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')
|
||||||
|
|
||||||
export REGISTRY_AUTH_FILE=$HOME/.docker/config.json
|
|
||||||
REGISTRY_PATH="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}"
|
|
||||||
|
|
||||||
# "zstd:chunked" mit Feineinstellung zwingt Skopeo, Pakete anhand ihrer
|
|
||||||
# Metadaten (sofern vorhanden) in reproduzierbare Chunks zu brechen.
|
|
||||||
podman unshare bash -c "
|
|
||||||
for tag in ${{ steps.metadata.outputs.tags }}; do
|
|
||||||
skopeo copy \
|
|
||||||
--dest-compress-format=zstd:chunked \
|
|
||||||
--dest-compress-level=5 \
|
|
||||||
--dest-oci-accept-uncompressed-layers \
|
|
||||||
containers-storage:localhost/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} \
|
|
||||||
docker://$REGISTRY_PATH:\$tag
|
|
||||||
done
|
|
||||||
"
|
|
||||||
|
|
||||||
FINAL_REGISTRY_DIGEST=$(skopeo inspect docker://$REGISTRY_PATH:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')
|
|
||||||
echo "REGISTRY_DIGEST=$FINAL_REGISTRY_DIGEST" >> $GITHUB_ENV
|
echo "REGISTRY_DIGEST=$FINAL_REGISTRY_DIGEST" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Cosign
|
- name: Install Cosign
|
||||||
|
|||||||
Reference in New Issue
Block a user