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

env variables used:

DOCKER_LOGIN_USERNAME
DOCKER_LOGIN_PASSWORD
set in /etc/gitlab/gitlabregistry.txt managed by Puppet

This is needed because gitlabregistry does not implement search.
therefore, one needs to list images through gitlab curl API using JSON
Web Token.
This is needed for tests outside of CI, were one must deduce ctageneric
docker image tag from commit ID, the format is <pipeline ID>git<commit
ID> and while we have access to commit ID, we cannot guess pipeline ID.
The idea is then to run the tests with the highest pipeline ID and the
commit ID of HEAD.
parent 1ef578b0
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# env variables used:
# DOCKER_LOGIN_USERNAME
# DOCKER_LOGIN_PASSWORD
#
# set in /etc/gitlab/gitlabregistry.txt managed by Puppet
. /etc/gitlab/gitlabregistry.txt
TO=gitlab-registry.cern.ch/cta/ctageneric
CI_REGISTRY=$(echo ${TO} | sed -e 's%/.*%%')
REPOSITORY=$(echo ${TO} | sed -e 's%[^/]\+/%%')
GITLAB_HOST=gitlab.cern.ch
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" | cut -d\" -f4 )
# echo "List of tags in registry"
curl "https://${CI_REGISTRY}/v2/${REPOSITORY}/tags/list" -H "Authorization: Bearer ${JWT_PULL_PUSH_TOKEN}" | jq -c ".tags[]" | sed -e 's/^"//;s/"$//'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment