Skip to content

Commit

Permalink
speed up image sync
Browse files Browse the repository at this point in the history
  • Loading branch information
anda-ren committed Oct 25, 2023
1 parent d24dda8 commit 15a722a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/publish/image_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ function get_tags() {
# start to sync images
declare -a starwhale_images=("server" "base" "cuda" "dataset_builder" "runtime-dockerizing")
for image in "${starwhale_images[@]}"; do
tags=$(get_tags "$image")
# if the image has already synced, regctl would skip it.
for tag in $tags; do
copy_image "$source_repo_name/$image:$tag" "$target_repo_name1/$image:$tag"
copy_image "$source_repo_name/$image:$tag" "$target_repo_name2/$image:$tag"
done
source_repo_tags=$(./regctl tag -v error ls "$source_registry"/star-whale/"$image")
target_repo_tags1=$(./regctl tag -v error ls docker-registry.starwhale.cn/"$target_repo_name1"/"$image")
target_repo_tags2=$(./regctl tag -v error ls docker-registry.starwhale.cn/"$target_repo_name2"/"$image")

while IFS= read -r line; do
copy_image "$source_repo_name/$image:$line" "$target_repo_name2/$image:$line"
done < <(comm -23 <(sort <<< "$source_repo_tags") <(sort <<< "$target_repo_tags1"))
while IFS= read -r line; do
copy_image "$source_repo_name/$image:$line" "$target_repo_name2/$image:$line"
done < <(comm -23 <(sort <<< "$source_repo_tags") <(sort <<< "$target_repo_tags2"))
done

0 comments on commit 15a722a

Please sign in to comment.