Add quickly compare feature
This commit is contained in:
parent
8b5190e06c
commit
31f741922b
|
@ -6,6 +6,7 @@ set -o pipefail
|
|||
|
||||
DEBUG="${DEBUG:-}"
|
||||
INCREMENTAL="${INCREMENTAL:-}"
|
||||
QUICKLY="${QUICKLY:-}"
|
||||
|
||||
declare -A DOMAIN_MAP=()
|
||||
|
||||
|
@ -61,7 +62,7 @@ for line in $(cat ./mirror.txt); do
|
|||
domain="${line%%/*}"
|
||||
new_image=$(echo "${line}" | sed "s/^${domain}/${DOMAIN_MAP["${domain}"]}/g")
|
||||
echo "Diff image ${line} ${new_image}"
|
||||
DEBUG="${DEBUG}" INCREMENTAL="${INCREMENTAL}" EXCLUDED="${exclude}" ./scripts/diff-image.sh "${line}" "${new_image}" 2>&1 | tee -a "${LOGFILE}" || {
|
||||
DEBUG="${DEBUG}" QUICKLY="${QUICKLY}" INCREMENTAL="${INCREMENTAL}" EXCLUDED="${exclude}" ./scripts/diff-image.sh "${line}" "${new_image}" 2>&1 | tee -a "${LOGFILE}" || {
|
||||
echo "Error: diff image ${line} ${new_image}"
|
||||
}
|
||||
done
|
||||
|
|
|
@ -13,6 +13,9 @@ DEBUG="${DEBUG:-}"
|
|||
# Allow image2 to have more tags than image1
|
||||
INCREMENTAL="${INCREMENTAL:-}"
|
||||
|
||||
# Compare only tags that are in both images
|
||||
QUICKLY="${QUICKLY:-}"
|
||||
|
||||
# Exclude tags that do not need to be checked
|
||||
EXCLUDED="${EXCLUDED:-}"
|
||||
|
||||
|
@ -109,6 +112,17 @@ function diff-image-with-tag() {
|
|||
local image1="${1:-}"
|
||||
local image2="${2:-}"
|
||||
|
||||
if [[ "${QUICKLY}" == "true" ]]; then
|
||||
local tag1="${image1##*:}"
|
||||
local tag2="${image2##*:}"
|
||||
if [[ "${tag1}" != "${tag2}" ]]; then
|
||||
echo "${SELF}: UNSYNC: ${image1} and ${image2} are not in synchronized" >&2
|
||||
return 1
|
||||
fi
|
||||
echo "${SELF}: SYNC: ${image1} and ${image2} are in synchronized" >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
local inspect1="$(inspect ${image1})"
|
||||
local inspect2="$(inspect ${image2})"
|
||||
local diff_raw=$(diff --unified <(echo "${inspect1}") <(echo "${inspect2}"))
|
||||
|
|
Loading…
Reference in New Issue