Skip to content

Commit

Permalink
支持@sha256的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
tech-shrimp committed Jun 12, 2024
1 parent 40b1c01 commit 19cb5c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 19cb5c7

Please sign in to comment.