diff --git a/.github/workflows/docker-image-mirror.yml b/.github/workflows/docker-image-mirror.yml index 1b61102..cfec67f 100644 --- a/.github/workflows/docker-image-mirror.yml +++ b/.github/workflows/docker-image-mirror.yml @@ -78,8 +78,11 @@ jobs: - name: Sync image id: syncImage + env: + DEST_HARBOR_URL: ${{ vars.DEST_HARBOR_URL }} shell: bash run: | + echo DEST_HARBOR_URL $DEST_HARBOR_URL bash jenkins_sync_docker_images.sh docker_images.list - name: Success check diff --git a/jenkins_sync_docker_images.sh b/jenkins_sync_docker_images.sh index e2379f6..649926a 100644 --- a/jenkins_sync_docker_images.sh +++ b/jenkins_sync_docker_images.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash +set -x cd "$(dirname "$0")" || return 1 SH_DIR=$(pwd) ME=$0 PARAMETERS=$* config_file="$1" -dest_repo="${DEST_HARBOR_URL}/${DEST_HARBOR_REGISTRY}" # 包含仓库项目的名字 -dest_registry="${DEST_HARBOR_REGISTRY}" +dest_registry="${DEST_HARBOR_REGISTRY:-library}" +dest_repo="${DEST_HARBOR_URL}/${dest_registry}" # 包含仓库项目的名字 thread=3 # 此处定义线程数 faillog="./failure.log" # 此处定义失败列表,注意失败列表会先被删除再重新写入 echo >> "$config_file" # 加行空行 @@ -233,7 +234,8 @@ function multi_process () { exec 6>&- # 关闭df6 } -have_skopeo=$(check_skopeo) +check_skopeo +have_skopeo=$? multi_process if [ -f $faillog ];then