mirror of
				https://github.com/DaoCloud/public-image-mirror.git
				synced 2025-10-31 21:59:22 +08:00 
			
		
		
		
	Update the filter of diff-image.sh
This commit is contained in:
		| @@ -26,7 +26,7 @@ for line in $(cat ./domain.txt); do | ||||
|     DOMAIN_MAP["${key}"]="${val}" | ||||
| done | ||||
|  | ||||
| declare -A EXCLUDED_MAP=() | ||||
| declare -A SKIP_MAP=() | ||||
|  | ||||
| for line in $(cat not_sync.yaml | yq -j '.not_sync[] | .image_pattern , "=", (.tag_patterns[] | . , "|" ) , "\n"' | sed "s/|$//g"); do | ||||
|     line="${line/ /}" | ||||
| @@ -40,7 +40,7 @@ for line in $(cat not_sync.yaml | yq -j '.not_sync[] | .image_pattern , "=", (.t | ||||
|         continue | ||||
|     fi | ||||
|  | ||||
|     EXCLUDED_MAP["${key}"]="${val}" | ||||
|     SKIP_MAP["${key}"]="${val}" | ||||
| done | ||||
|  | ||||
| LOGFILE="./check-image.log" | ||||
| @@ -55,19 +55,19 @@ for line in ${images}; do | ||||
|         continue | ||||
|     fi | ||||
|  | ||||
|     exclude="" | ||||
|     for key in "${!EXCLUDED_MAP[@]}"; do | ||||
|     skip="" | ||||
|     for key in "${!SKIP_MAP[@]}"; do | ||||
|         if [[ "${line}" =~ ${key} ]]; then | ||||
|             exclude+="${EXCLUDED_MAP[$key]}|" | ||||
|             skip+="${SKIP_MAP[$key]}|" | ||||
|         fi | ||||
|     done | ||||
|     exclude="${exclude%|}" | ||||
|     skip="${skip%|}" | ||||
|  | ||||
|     domain="${line%%/*}" | ||||
|     new_image=$(echo "${line}" | sed "s/^${domain}/${DOMAIN_MAP["${domain}"]}/g") | ||||
|     count=$((count + 1)) | ||||
|     echo "Diff ${count}/${images_count} image ${line} ${new_image}" | ||||
|     DEBUG="${DEBUG}" QUICKLY="${QUICKLY}" INCREMENTAL="${INCREMENTAL}" PARALLET="${PARALLET}" EXCLUDED="${exclude}" ./scripts/diff-image.sh "${line}" "${new_image}" 2>&1 | tee -a "${LOGFILE}" || { | ||||
|     DEBUG="${DEBUG}" QUICKLY="${QUICKLY}" INCREMENTAL="${INCREMENTAL}" PARALLET="${PARALLET}" SKIP="${skip}" ./scripts/diff-image.sh "${line}" "${new_image}" 2>&1 | tee -a "${LOGFILE}" || { | ||||
|         echo "Error: diff image ${line} ${new_image}" | ||||
|     } | ||||
| done | ||||
|   | ||||
| @@ -16,8 +16,11 @@ INCREMENTAL="${INCREMENTAL:-}" | ||||
| # Compare only tags that are in both images | ||||
| QUICKLY="${QUICKLY:-}" | ||||
|  | ||||
| # Exclude tags that do not need to be checked | ||||
| EXCLUDED="${EXCLUDED:-}" | ||||
| # Regexp that matches the tags | ||||
| FOCUS="${FOCUS:-}" | ||||
|  | ||||
| # Regexp that matches the tags that needs to be skipped | ||||
| SKIP="${SKIP:-}" | ||||
|  | ||||
| # Compare the number of tags in parallel | ||||
| PARALLET="${PARALLET:-0}" | ||||
| @@ -30,7 +33,8 @@ if [[ "${DEBUG}" == "true" ]]; then | ||||
|     echo "IMAGE2:      ${IMAGE2}" | ||||
|     echo "INCREMENTAL: ${INCREMENTAL}" | ||||
|     echo "QUICKLY:     ${QUICKLY}" | ||||
|     echo "EXCLUDED:    ${EXCLUDED}" | ||||
|     echo "FOCUS:       ${FOCUS}" | ||||
|     echo "SKIP:        ${SKIP}" | ||||
|     echo "PARALLET:    ${PARALLET}" | ||||
| fi | ||||
|  | ||||
| @@ -48,7 +52,8 @@ function check() { | ||||
|         echo " DEBUG=true         # Output more information that is out of sync" | ||||
|         echo " INCREMENTAL=true   # Allow image2 to have more tags than image1" | ||||
|         echo " QUICKLY=true       # Compare only tags that are in both images" | ||||
|         echo " EXCLUDED=<pattern> # Exclude tags that do not need to be checked" | ||||
|         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" | ||||
|         return 2 | ||||
|     fi | ||||
| @@ -126,8 +131,12 @@ function list-tags() { | ||||
|     local image="${1:-}" | ||||
|     local raw="$(skopeo list-tags --tls-verify=false "docker://${image}" | jq -r '.Tags[]' | sort)" | ||||
|  | ||||
|     if [[ "${EXCLUDED}" != "" ]]; then | ||||
|         raw="$(echo "${raw}" | grep -v -E "${EXCLUDED}" || :)" | ||||
|     if [[ "${FOCUS}" != "" ]]; then | ||||
|         raw="$(echo "${raw}" | grep -E "${FOCUS}" || :)" | ||||
|     fi | ||||
|  | ||||
|     if [[ "${SKIP}" != "" ]]; then | ||||
|         raw="$(echo "${raw}" | grep -v -E "${SKIP}" || :)" | ||||
|     fi | ||||
|     echo "${raw}" | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user