From 19cb5c7a8f988cd1d3e1367ad04540f48f7c39c6 Mon Sep 17 00:00:00 2001 From: tech-shrimp Date: Wed, 12 Jun 2024 12:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81@sha256=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 5a2c0fafc1..9479a96956 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -39,6 +39,8 @@ jobs: # 获取镜像的完整名称,例如kasmweb/nginx:1.25.3(命名空间/镜像名:版本号) image=$(echo "$line" | awk '{print $NF}') + # 将@sha256:等字符删除 + image="${image%%@*}" echo "image $image" # 获取镜像名:版本号 例如nginx:1.25.3 image_name_tag=$(echo "$image" | awk -F'/' '{print $NF}') @@ -50,6 +52,7 @@ jobs: name_space="${name_space}_" # 获取镜像名例如nginx image_name=$(echo "$image_name_tag" | awk -F':' '{print $1}') + echo "image_name: $image_name" # 如果镜像存在于数组中,则添加temp_map if [[ -n "${temp_map[$image_name]}" ]]; then @@ -85,6 +88,7 @@ jobs: echo "platform_prefix is $platform_prefix" # 获取镜像的完整名称,例如kasmweb/nginx:1.25.3(命名空间/镜像名:版本号) image=$(echo "$line" | awk '{print $NF}') + # 获取 镜像名:版本号 例如nginx:1.25.3 image_name_tag=$(echo "$image" | awk -F'/' '{print $NF}') # 获取命名空间 例如kasmweb 这里有种特殊情况 docker.io/nginx,把docker.io当成命名空间,也OK @@ -101,6 +105,8 @@ jobs: fi fi + # 将@sha256:等字符删除 + image_name_tag="${image_name_tag%%@*}" new_image="$ALIYUN_REGISTRY/$ALIYUN_NAME_SPACE/$platform_prefix$name_space_prefix$image_name_tag" echo "docker tag $image $new_image" docker tag $image $new_image