mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-26 20:16:04 +01:00
update clean registry
Signed-off-by: Jess Frazelle <acidburn@github.com>
This commit is contained in:
parent
c70cf86b55
commit
8cd8c59cde
|
@ -32,6 +32,7 @@ for repo in "${repos[@]}"; do
|
|||
# get the latest index for the tag
|
||||
current=$(gsutil cat "${BUCKET_PREFIX}/repositories/${repo}/_manifests/tags/${tag}/current/link" || true)
|
||||
if [[ "$current" == "true" ]]; then
|
||||
# continue the loop since we cannot cat
|
||||
continue
|
||||
fi
|
||||
# split on : since the link comes back as:
|
||||
|
@ -39,6 +40,23 @@ for repo in "${repos[@]}"; do
|
|||
ha=${current%:*}
|
||||
id=${current#*:}
|
||||
|
||||
# get the manifest
|
||||
manifest=$(gsutil cat "${BUCKET_PREFIX}/blobs/sha256/${id:0:2}/${id}/data" || true)
|
||||
if [[ "$manifest" == "true" ]]; then
|
||||
# continue the loop since we cannot cat
|
||||
continue
|
||||
fi
|
||||
manifest_media_type=$(echo ${manifest} | jq -r '.mediaType')
|
||||
echo "media-type: $manifest_media_type"
|
||||
|
||||
|
||||
if [ "${manifest_media_type}" == "application/vnd.docker.distribution.manifest.list.v2+json" ] ; then
|
||||
# we have a manifest list and fetch the referenced manifests
|
||||
additional_manifests=( $(echo ${manifest} | jq -r '.["manifests"] | .[].digest' | cut -d: -f2) )
|
||||
|
||||
echo "additional_manifests: ${additional_manifests[@]}"
|
||||
fi
|
||||
|
||||
echo "repo: $repo | tag: $tag | current: ${ha}:${id}"
|
||||
|
||||
# get the shas
|
||||
|
@ -49,7 +67,8 @@ for repo in "${repos[@]}"; do
|
|||
|
||||
# shellcheck disable=SC2199
|
||||
if [[ "${shas[@]}" != "" ]] && [[ ! -z "${shas[@]}" ]]; then
|
||||
parallel -j"${JOBS}" reg rm "${REPO_URL}/${repo}@${ha}:{1}" ::: "${shas[@]}" || true
|
||||
echo "[to be removed]: ${shas[@]}"
|
||||
#parallel -j"${JOBS}" reg rm "${REPO_URL}/${repo}@${ha}:{1}" ::: "${shas[@]}" || true
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user