Commit 341fdd4c authored by Дмитрий Сафронов's avatar Дмитрий Сафронов
Browse files

errors

parent 0faa39c0
Loading
Loading
Loading
Loading
Loading

.hadolint.yaml

0 → 100644
+3 −0
Original line number Diff line number Diff line
ignored:
  - DL3007
  - DL3018
+9 −4
Original line number Diff line number Diff line
@@ -25,9 +25,14 @@ test -n "${TO_DIE}" && exit 1

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)"
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" 2> /dev/null | jq -r .token)"
test -z "${TOKEN}" && die "Could not obtain token"

MANIFEST="$(curl -H "${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_OLD}")"
MANIFEST="$(curl -H "${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_OLD}" 2> /dev/null)"
test -z "${TOKEN}" && die "Could not obtain manifest"

curl -X PUT -H "Content-Type: ${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" -d "${MANIFEST}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_NEW}" && \
echo "New image: ${CI_REGISTRY}/${IMAGE_PATH}:${REGISTRY_TAG_NEW}"
curl -X PUT -H "Content-Type: ${CONTENT_TYPE}" -H "Authorization: Bearer ${TOKEN}" -d "${MANIFEST}" "${REGISTRY_SCHEMA:-https}://${CI_REGISTRY}/v2/${IMAGE_PATH}/manifests/${REGISTRY_TAG_NEW}" 2> /dev/null && \
echo "New image: ${CI_REGISTRY}/${IMAGE_PATH}:${REGISTRY_TAG_NEW}" || die "Could not set tag"

##########################################################################################################################
test -n "${TO_DIE}" && exit 1