working on image retagging
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -27,6 +27,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Re-tag the most recent image
|
- name: Re-tag the most recent image
|
||||||
run: |
|
run: |
|
||||||
|
set -x
|
||||||
REGISTRY="${{ secrets.REGISTRY_PATH }}"
|
REGISTRY="${{ secrets.REGISTRY_PATH }}"
|
||||||
REPO="umbrella"
|
REPO="umbrella"
|
||||||
USER="${{ secrets.DOCKER_USERNAME }}"
|
USER="${{ secrets.DOCKER_USERNAME }}"
|
||||||
@@ -35,14 +36,14 @@ jobs:
|
|||||||
NEW_TAG="${{ gitea.sha_short }}"
|
NEW_TAG="${{ gitea.sha_short }}"
|
||||||
|
|
||||||
# Get auth token (basic auth for most self-hosted registries)
|
# Get auth token (basic auth for most self-hosted registries)
|
||||||
TOKEN=$(curl -s -u "$USER:$PASS" "https://$REGISTRY/v2/token?service=$REGISTRY&scope=repository:$REPO:pull,push")
|
#TOKEN=$(curl -s -u "$USER:$PASS" "https://$REGISTRY/v2/token?service=$REGISTRY&scope=repository:$REPO:pull,push")
|
||||||
AUTH="Bearer $(echo $TOKEN | jq -r .token)"
|
#AUTH="Bearer $(echo $TOKEN | jq -r .token)"
|
||||||
|
|
||||||
# Fetch latest manifest (specify mediaType header for OCI support)
|
# Fetch latest manifest (specify mediaType header for OCI support)
|
||||||
MANIFEST=$(curl -s -H "Authorization: $AUTH" -H "Accept: application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json" "https://$REGISTRY/v2/$REPO/manifests/$LATEST" | jq -c .)
|
MANIFEST=$(curl -s -u "$USER:$PASS" -H "Accept: application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json" "https://$REGISTRY/v2/$REPO/manifests/$LATEST" | jq -c .)
|
||||||
|
|
||||||
# PUT manifest under new tag
|
# PUT manifest under new tag
|
||||||
curl -X PUT -s -H "Authorization: $AUTH" -H "Content-Type: application/vnd.docker.distribution.manifest.v2+json" --data "$MANIFEST" "https://$REGISTRY/v2/$REPO/manifests/$NEW_TAG"
|
curl -X PUT -s -u "$USER:$PASS" -H "Content-Type: application/vnd.docker.distribution.manifest.v2+json" --data "$MANIFEST" "https://$REGISTRY/v2/$REPO/manifests/$NEW_TAG"
|
||||||
|
|
||||||
echo "Tagged $REGISTRY/$REPO:$LATEST -> $NEW_TAG"
|
echo "Tagged $REGISTRY/$REPO:$LATEST -> $NEW_TAG"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user