From 3e00aef08168487767f50d72670bd9cf5cc32e5d Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov <zimniy@cyberbrain.pw> Date: Wed, 23 Mar 2022 17:32:25 +0300 Subject: [PATCH] test --- entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a1698e2..484d1c3 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -27,8 +27,14 @@ CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" TOKEN="$(curl --user "${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}" "${SERVER_HOST_SCHEMA:-https}://${CI_SERVER_HOST}/jwt/auth?offline_token=true&service=container_registry&scope=repository:${CI_PROJECT_PATH}:push,pull" | jq -r .token)" +curl -H "${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_OLD}" + RESULT="$(curl -H "${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_OLD}")" -echo ${RESULT} +########################################################################################################################## + +test -z "$(echo ${RESULT} | jq -r .mediaType)" && die "Manifest is missing" +test -n "$(echo ${RESULT} | jq -r .errors[])" && die "Errors are present" -echo ${RESULT} | jq -r .errors.code +########################################################################################################################## +test -n "${TO_DIE}" && exit 1 -- GitLab