Skip to content

Instantly share code, notes, and snippets.

@itsamenathan
Created April 7, 2017 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsamenathan/e0cac997adb3b4796591ace9cae750a0 to your computer and use it in GitHub Desktop.
Save itsamenathan/e0cac997adb3b4796591ace9cae750a0 to your computer and use it in GitHub Desktop.
Get docker image tags from Gitlab Registry
#/bin/bash
set -e
AUTH_URL="https://gitlab.com/jwt/auth"
SERVICE="container_registry"
SCOPE="repository:group_name/image_name:pull"
AUTH="some_passowrd"
TOKEN=$(curl -s -H "Authorization: Basic ${AUTH}" "${AUTH_URL}?service=${SERVICE}&scope=${SCOPE}" | jq '.token' -r )
ACCEPT_HEADER="Accept: application/vnd.docker.distribution.manifest.v2+json"
API_URL="https://gitlab.com:5005/v2"
REPO="group_name/image_name"
curl -H "${ACCEPT_HEADER}" -H "Authorization: Bearer ${TOKEN}" "${API_URL}/${REPO}/tags/list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment