ligo/scripts/ci/docker_registry_delete.sh
Grégoire Henry 55db2dbf18 CI: improve pipeline duration
- do not use a intermediate docker image between 'build' and 'test'
- in 'build_deps', avoid downloading the cached image
- in 'prepare', use `opam bundle` to:
  - embedded the sources of dependency
  - reduce the embedded opam repository to the needed package

Other changes:

- reintroduced 'sudo' in the base image, it is needed by `opam depext`
  and the job 'publish:doc'
- moved the docker script used by the CI in `scripts/ci/`
2018-01-28 20:03:31 +01:00

42 lines
927 B
Bash
Executable File

#! /bin/sh
set -e
set -x
ci_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
script_dir="$(dirname "$ci_dir")"
src_dir="$(dirname "$script_dir")"
cd "$src_dir"
. "$ci_dir"/docker_registry.inc.sh
username="$1"
password="$2"
reponame="${3##registry.gitlab.com/}"
shift 3
tags="${@:-latest}"
for tag in $tags; do
scope='push,pull'
token="$(getBearerToken "${username}" "${password}" "${reponame}")"
if [ -z "$token" ]; then
echo "Failed to fetch the Bearer token"
exit 1
fi
digest="$(getTagDigest "${token}" "${reponame}" "${tag}")"
if [ -z "$digest" ]; then
echo "Failed to locate the ${reponame}:${tag}"
exit 1
fi
scope='*'
token="$(getBearerToken "${username}" "${password}" "${reponame}")"
if [ -z "$token" ]; then
echo "Failed to fetch the Bearer token"
exit 1
fi
deleteDigest "${token}" "${reponame}" "${digest}"
done