Deep checks skip explicit tags

This commit is contained in:
Shiming Zhang 2021-12-09 19:26:51 +08:00
parent f753d17b19
commit 68b1aacced
3 changed files with 36 additions and 24 deletions

View File

@ -14,11 +14,13 @@ jobs:
env:
only_proxy: ".m.daocloud.io"
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.7.10/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
wget https://github.com/wzshiming/bridge/releases/download/v0.7.11/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Check
env:
INCREMENTAL: "true"
QUICKLY: "true"
QUICKLY_PATTERN: '[0-9]+(\.[0-9]+){2}'
PARALLET: "10"
http_proxy: socks5://127.0.0.1:8080
https_proxy: socks5://127.0.0.1:8080

View File

@ -16,11 +16,13 @@ jobs:
env:
only_proxy: ".m.daocloud.io"
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.7.10/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
wget https://github.com/wzshiming/bridge/releases/download/v0.7.11/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Sync Images
env:
INCREMENTAL: "true"
QUICKLY: "true"
QUICKLY_PATTERN: '[0-9]+(\.[0-9]+){2}'
SYNC: "true"
PARALLET: "5"
http_proxy: socks5://127.0.0.1:8080

View File

@ -19,6 +19,9 @@ INCREMENTAL="${INCREMENTAL:-}"
# Compare only tags that are in both images
QUICKLY="${QUICKLY:-}"
# If set, will compare the image tag patterns
QUICKLY_PATTERN="${QUICKLY_PATTERN:-}"
# Regexp that matches the tags
FOCUS="${FOCUS:-}"
@ -37,18 +40,19 @@ RETRY="${RETRY:-5}"
SELF="$(basename "${BASH_SOURCE[0]}")"
if [[ "${DEBUG}" == "true" ]]; then
echo "DEBUG: ${DEBUG}"
echo "IMAGE1: ${IMAGE1}"
echo "IMAGE2: ${IMAGE2}"
echo "SKOPEO: ${SKOPEO}"
echo "JQ: ${JQ}"
echo "INCREMENTAL: ${INCREMENTAL}"
echo "QUICKLY: ${QUICKLY}"
echo "FOCUS: ${FOCUS}"
echo "SKIP: ${SKIP}"
echo "PARALLET: ${PARALLET}"
echo "SYNC: ${SYNC}"
echo "RETRY: ${RETRY}"
echo "DEBUG: ${DEBUG}"
echo "IMAGE1: ${IMAGE1}"
echo "IMAGE2: ${IMAGE2}"
echo "SKOPEO: ${SKOPEO}"
echo "JQ: ${JQ}"
echo "INCREMENTAL: ${INCREMENTAL}"
echo "QUICKLY: ${QUICKLY}"
echo "QUICKLY_PATTERN: ${QUICKLY_PATTERN}"
echo "FOCUS: ${FOCUS}"
echo "SKIP: ${SKIP}"
echo "PARALLET: ${PARALLET}"
echo "SYNC: ${SYNC}"
echo "RETRY: ${RETRY}"
fi
function check() {
@ -62,14 +66,15 @@ function check() {
echo " ${SELF}: <image1> <image2>"
echo " ${SELF}: <image1:tag> <image2:tag>"
echo "Env:"
echo " DEBUG=true # Output more information that is out of synchronize"
echo " INCREMENTAL=true # Allow image2 to have more tags than image1"
echo " QUICKLY=true # Compare only tags that are in both images"
echo " FOCUS=<pattern> # Regexp that matches the tags"
echo " SKIP=<pattern> # Regexp that matches the tags that needs to be skipped"
echo " PARALLET=<size> # Compare the number of tags in parallel"
echo " SYNC=true # Synchronize images from source to destination"
echo " RETRY=<times> # Retry times"
echo " DEBUG=true # Output more information that is out of synchronize"
echo " INCREMENTAL=true # Allow image2 to have more tags than image1"
echo " QUICKLY=true # Compare only tags that are in both images"
echo " QUICKLY_PATTERN=<pattern> # Regexp that matches the tags"
echo " FOCUS=<pattern> # Regexp that matches the tags"
echo " SKIP=<pattern> # Regexp that matches the tags that needs to be skipped"
echo " PARALLET=<size> # Compare the number of tags in parallel"
echo " SYNC=true # Synchronize images from source to destination"
echo " RETRY=<times> # Retry times"
return 2
fi
@ -192,8 +197,11 @@ function diff-image-with-tag() {
echo "${SELF}: NOT-SYNCHRONIZED: ${image1} and ${image2} are not in synchronized" >&2
return 1
fi
echo "${SELF}: SYNCHRONIZED: ${image1} and ${image2} are in synchronized" >&2
return 0
if [[ "${QUICKLY_PATTERN}" == "" || ("${QUICKLY_PATTERN}" != "" && "${tag1}" =~ ${QUICKLY_PATTERN}) ]]; then
echo "${SELF}: SYNCHRONIZED: ${image1} and ${image2} are in synchronized" >&2
return 0
fi
fi
local inspect2="$(inspect ${image2})"