Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions gitlab-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# CONTAINERS_FILE - Optional artifact filename which lists the desired images to be cached in a multiline format
# CONTAINER_CONVERT - define if the images must be converted to store in gitlab
# CONTAINER_PREFIX - extra prefix for the images. Can be used to add a string on the front of an image name or a parent directory in the repository.
# FORCE_REFRESH - Optional flag to indicate that the mirrored container should be pulled even if the tag is already seen.
# RETAG - Change the tag or sha of the image. to rename the image from foo:bar to foo:baz, set to "\1:baz"
# SOURCE_USERNAME - Optional username to use for download
# SOURCE_PASSWORD - Optional password to use for download
Expand Down Expand Up @@ -31,14 +32,16 @@
mkdir -p /tmp/containers/"$NEWNAME"
echo Mirroring "$IMAGE" to "$NEWNAME"
if [ "x$CONTAINER_CONVERT" != "x" ]; then
set +e
skopeo inspect \
docker://"${DEST_REGISTRY}/${DEST_REGISTRY_PATH}/${CONTAINER_PREFIX}$NEWNAME" \
--raw \
--cert-dir /etc/gitlab-runner/certs/ \
--creds "${DEST_REGISTRY_USERNAME}:${DEST_REGISTRY_PASSWORD}" \
> /dev/null && echo already exists && continue
set -xe
if [ "x$FORCE_REFRESH" == "x"]; then
set +e
skopeo inspect \
docker://"${DEST_REGISTRY}/${DEST_REGISTRY_PATH}/${CONTAINER_PREFIX}$NEWNAME" \
--raw \
--cert-dir /etc/gitlab-runner/certs/ \
--creds "${DEST_REGISTRY_USERNAME}:${DEST_REGISTRY_PASSWORD}" \
> /dev/null && echo already exists && continue
set -xe
fi
skopeo copy $EXTRA_FLAGS \
--format v2s2 \
docker://"$IMAGE" \
Expand Down