7413f9183a
All checks were successful
Test skopeo-copy action / test-process (push) Successful in 58s
31 lines
742 B
Bash
Executable File
31 lines
742 B
Bash
Executable File
#!/usr/bin/env bash
|
|
source=$1
|
|
dest=$2
|
|
args=${3:-"-a"}
|
|
images=$4
|
|
tags=$5
|
|
|
|
echo "source=$1"
|
|
echo "dest=$2"
|
|
echo "args=$3"
|
|
echo "images=$4"
|
|
echo "tags=$5"
|
|
|
|
images=$(echo $images | jq -R 'split(",")' 2> /dev/null)
|
|
tags=$(echo $tags | jq -R 'split(",")' 2> /dev/null)
|
|
|
|
for IM in $(echo $images | jq '.[]' -r 2> /dev/null | xargs)
|
|
do
|
|
echo "start copy image $IM"
|
|
echo "get all tags for image in source"
|
|
extags=$(skopeo list-tags $source/$IM | jq '.Tags.[]' -r 2> /dev/null | xargs)
|
|
for TAG in $(echo $tags | jq '.[]' -r 2> /dev/null | xargs)
|
|
do
|
|
echo "copy tag $TAG"
|
|
if echo $extags | grep $TAG 2> /dev/null
|
|
then skopeo copy $args $source/$IM:$TAG $dest/$IM:$TAG
|
|
fi
|
|
done
|
|
echo "finish with image $IM"
|
|
done
|