diff --git a/Jenkinsfile.pjt b/Jenkinsfile.pjt index d093e1f..f3dd9cc 100644 --- a/Jenkinsfile.pjt +++ b/Jenkinsfile.pjt @@ -234,9 +234,10 @@ pipeline { sh ''' set -e - + echo "[1/2] Remove registry old image tag list" TAGS_TO_DELETE=$(curl -s -u "$DOCKER_USER:$DOCKER_PASS" https://${REGISTRY_HOST}/v2/${IMAGE_REPO}/tags/list | jq -r '.tags[]' | grep -E '^[0-9]+' | sort -t- -k1,1n | head -n -5) + echo "[2/2] Remove registry old image sha list and delete registry" for TAG in $TAGS_TO_DELETE; do DIGEST=$(curl -s -u "$DOCKER_USER:$DOCKER_PASS" -H "Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json" -D - https://${REGISTRY_HOST}/v2/${IMAGE_REPO}/manifests/$TAG -o /dev/null | grep -i Docker-Content-Digest | awk '{print $2}' | tr -d $'\r')