Skip to content
Snippets Groups Projects
Commit 6050bfc8 authored by Julien Leduc's avatar Julien Leduc
Browse files

renaming tag according to CTA_BUILD_ID

parent 424fc017
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ stages:
- build:srpm
- build:rpm
- build:dockerimage
- rename:dockerimage
before_script:
- export CTA_BUILD_ID=${CI_PIPELINE_ID}git${CI_BUILD_REF:0:8}
......@@ -56,3 +57,22 @@ ctafrontend_docker:
variables:
TO: gitlab-registry.cern.ch/cta/cta-orchestration:${CI_PIPELINE_ID}
DOCKER_FILE: continuousintegration/docker/ctafrontend/cc7/Dockerfile
ctafrontend_docker_rename:
stage: rename:dockerimage
variables:
REPOSITORY: cta/cta-orchestration
GITLAB_HOST: gitlab.cern.ch
script:
- OLDTAG=${CI_PIPELINE_ID}
- NEWTAG=${CTA_BUILD_ID}
- JWT_PULL_PUSH_TOKEN=$(curl -q -u ${DOCKER_LOGIN_USERNAME}:${DOCKER_LOGIN_PASSWORD} "https://${GITLAB_HOST}/jwt/auth?service=container_registry&scope=repository:${REPOSITORY}:pull,push" | jq .token -r)
- echo "List of tags in registry"
- curl "https://${CI_REGISTRY}/v2/${REPOSITORY}/tags/list" -H "Authorization: Bearer ${JWT_PULL_PUSH_TOKEN}"
- echo "Pulling the manifest of tag:${OLDTAG}"
- curl "https://${CI_REGISTRY}/v2/${REPOSITORY}/manifests/${OLDTAG}" -H "Authorization: Bearer ${JWT_PULL_PUSH_TOKEN}" -H 'accept: application/vnd.docker.distribution.manifest.v2+json' > manifest.json
- echo "Pushing new tag: ${NEWTAG}"
- curl -XPUT "https://${CI_REGISTRY}/v2/${REPOSITORY}/manifests/${NEWTAG}" -H "Authorization: Bearer ${JWT_PULL_PUSH_TOKEN}" -H 'content-type: application/vnd.docker.distribution.manifest.v2+json' -d '@manifest.json' -v
- echo "List of tags in registry"
- curl "https://${CI_REGISTRY}/v2/${REPOSITORY}/tags/list" -H "Authorization: Bearer ${JWT_PULL_PUSH_TOKEN}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment