Support excluded tag
This commit is contained in:
parent
c1dd577d25
commit
6842299d88
|
@ -21,16 +21,41 @@ for line in $(cat ./domain.txt); do
|
|||
DOMAIN_MAP["${key}"]="${val}"
|
||||
done
|
||||
|
||||
declare -A EXCLUDED_MAP=()
|
||||
|
||||
for line in $(cat not_sync.yaml | yq -j '.not_sync[] | .image_pattern , "=", (.tag_patterns[] | . , "|" ) , "\n"' | sed "s/|$//g"); do
|
||||
line="${line/ /}"
|
||||
if [[ "$line" == "" ]]; then
|
||||
continue
|
||||
fi
|
||||
key="${line%%=*}"
|
||||
val="${line##*=}"
|
||||
if [[ "${key}" == "" || "${val}" == "" ]]; then
|
||||
echo "Error: invalid line: ${line}"
|
||||
continue
|
||||
fi
|
||||
|
||||
EXCLUDED_MAP["${key}"]="${val}"
|
||||
done
|
||||
|
||||
for line in $(cat ./mirror.txt); do
|
||||
line="${line/ /}"
|
||||
if [[ "$line" == "" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
exclude=""
|
||||
for key in "${!EXCLUDED_MAP[@]}"; do
|
||||
if [[ "${line}" =~ ${key} ]]; then
|
||||
exclude+="${EXCLUDED_MAP[$key]}|"
|
||||
fi
|
||||
done
|
||||
exclude="${exclude%|}"
|
||||
|
||||
domain="${line%%/*}"
|
||||
new_image=$(echo "${line}" | sed "s/^${domain}/${DOMAIN_MAP["${domain}"]}/g")
|
||||
echo "Diff image ${line} ${new_image}"
|
||||
DEBUG=true INCREMENTAL=true ./scripts/diff-image.sh "${line}" "${new_image}" || {
|
||||
DEBUG=true INCREMENTAL=true EXCLUDED="${exclude}" ./scripts/diff-image.sh "${line}" "${new_image}" || {
|
||||
echo "Error: diff image ${line} ${new_image}"
|
||||
}
|
||||
done
|
||||
|
|
|
@ -13,6 +13,9 @@ DEBUG="${DEBUG:-}"
|
|||
# Allow image2 to have more tags than image1
|
||||
INCREMENTAL="${INCREMENTAL:-}"
|
||||
|
||||
# Exclude tags that do not need to be checked
|
||||
EXCLUDED="${EXCLUDED:-}"
|
||||
|
||||
SELF="$(basename "${BASH_SOURCE[0]}")"
|
||||
|
||||
function check() {
|
||||
|
@ -94,7 +97,12 @@ function inspect() {
|
|||
|
||||
function list-tags() {
|
||||
local image="${1:-}"
|
||||
skopeo list-tags --tls-verify=false "docker://${image}" | jq -r '.Tags[]' | sort
|
||||
local raw="$(skopeo list-tags --tls-verify=false "docker://${image}" | jq -r '.Tags[]' | sort)"
|
||||
|
||||
if [[ "${EXCLUDED}" != "" ]]; then
|
||||
raw="$(echo "${raw}" | grep -v -E "${EXCLUDED}")"
|
||||
fi
|
||||
echo "${raw}"
|
||||
}
|
||||
|
||||
function diff-image-with-tag() {
|
||||
|
|
Loading…
Reference in New Issue