From 68b1aaccedb57a6d2fb63c2a5f70b1189b354ab1 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Thu, 9 Dec 2021 19:26:51 +0800 Subject: [PATCH] Deep checks skip explicit tags --- .github/workflows/deep-check.yml | 4 ++- .github/workflows/deep-sync.yml | 4 ++- hack/diff-image.sh | 52 ++++++++++++++++++-------------- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deep-check.yml b/.github/workflows/deep-check.yml index c4fff09..f699c3a 100644 --- a/.github/workflows/deep-check.yml +++ b/.github/workflows/deep-check.yml @@ -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 diff --git a/.github/workflows/deep-sync.yml b/.github/workflows/deep-sync.yml index 6f1f0b8..55107b9 100644 --- a/.github/workflows/deep-sync.yml +++ b/.github/workflows/deep-sync.yml @@ -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 diff --git a/hack/diff-image.sh b/hack/diff-image.sh index e56dff7..6baf5a0 100755 --- a/hack/diff-image.sh +++ b/hack/diff-image.sh @@ -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}: " echo " ${SELF}: " 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= # Regexp that matches the tags" - echo " SKIP= # Regexp that matches the tags that needs to be skipped" - echo " PARALLET= # Compare the number of tags in parallel" - echo " SYNC=true # Synchronize images from source to destination" - echo " RETRY= # 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= # Regexp that matches the tags" + echo " FOCUS= # Regexp that matches the tags" + echo " SKIP= # Regexp that matches the tags that needs to be skipped" + echo " PARALLET= # Compare the number of tags in parallel" + echo " SYNC=true # Synchronize images from source to destination" + echo " RETRY= # 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})"