mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6428 Handle multiple source images and multiple destinations.
Also update the scripts to be executable.
This commit is contained in:
0
scripts/cleanImages.sh
Normal file → Executable file
0
scripts/cleanImages.sh
Normal file → Executable file
76
scripts/pushDockerDigestTag.sh
Normal file → Executable file
76
scripts/pushDockerDigestTag.sh
Normal file → Executable file
@@ -2,30 +2,76 @@
|
|||||||
|
|
||||||
scriptName=`basename "$0"`
|
scriptName=`basename "$0"`
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
usage="Usage: $scriptName [options]
|
||||||
echo "Usage: ${scriptName} <imageName> <existingTag>"
|
|
||||||
|
-h , --help show this help text
|
||||||
|
-i <sourceImage> a source image to use
|
||||||
|
(e.g. quay.io/alfresco/ags-share-community)
|
||||||
|
-r <repository> a repository to push new tags to
|
||||||
|
(e.g. registry.hub.docker.com)
|
||||||
|
-t <tag> the existing tag for the images (mandatory)
|
||||||
|
-d <digestLength> the length of digest to output (default 12 chars)"
|
||||||
|
|
||||||
|
digestLength=12
|
||||||
|
|
||||||
|
while getopts ':hi:r:t:d:' option; do
|
||||||
|
case "$option" in
|
||||||
|
h) echo -e "Tag one or more images to include the digest and push this to some repositories.\n\n${usage}"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
i) sourceImages+=("$OPTARG")
|
||||||
|
;;
|
||||||
|
r) repositories+=("$OPTARG")
|
||||||
|
;;
|
||||||
|
t) existingTag=$OPTARG
|
||||||
|
;;
|
||||||
|
d) digestLength=$OPTARG
|
||||||
|
;;
|
||||||
|
:) echo -e "Missing argument for -${OPTARG}\n\n${usage}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
\?) echo -e "Illegal option: -${OPTARG}\n\n${usage}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
|
if [ "#$existingTag" == "#" ]; then
|
||||||
|
echo -e "Please supply a tag with the -t option.\n\n${usage}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${scriptName} called with:"
|
for sourceImage in ${sourceImages[@]}
|
||||||
image=$1
|
do
|
||||||
echo " image: $image"
|
echo "Processing $sourceImage"
|
||||||
existingTag=$2
|
|
||||||
echo " existingTag: $existingTag"
|
|
||||||
|
|
||||||
DIGEST_LENGTH=12
|
|
||||||
|
|
||||||
# Note that this command should work even if the image is already present locally.
|
# Note that this command should work even if the image is already present locally.
|
||||||
digest=`docker pull ${image}:${existingTag} | grep "Digest:" | awk -F':' '{print $3}' | cut -c 1-$DIGEST_LENGTH`
|
digest=`docker pull ${sourceImage}:${existingTag} | grep "Digest:" | awk -F':' '{print $3}' | cut -c 1-$digestLength`
|
||||||
|
|
||||||
if [ ${#digest} != $DIGEST_LENGTH ]
|
if [ ${#digest} != $digestLength ]
|
||||||
then
|
then
|
||||||
echo "Unexpected length for digest: '$digest'"
|
echo "Unexpected length for digest of ${sourceImage}: '${digest}'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
newTag=${existingTag}_${digest}
|
newTag=${existingTag}_${digest}
|
||||||
docker tag ${image}:${existingTag} ${image}:${newTag}
|
|
||||||
docker push ${image}:${newTag}
|
|
||||||
|
|
||||||
echo "Pushed ${image}:${existingTag} to ${image}:${newTag}"
|
# Remove the source repository name if it contains one.
|
||||||
|
slashes=`echo $sourceImage | sed "s|[^/]||g"`
|
||||||
|
if [ ${#slashes} == 2 ]
|
||||||
|
then
|
||||||
|
# The repository name is everything up to the first slash.
|
||||||
|
image=`echo $sourceImage | sed "s|[^/]*/||"`
|
||||||
|
else
|
||||||
|
# Assume the source image doesn't reference the repository name.
|
||||||
|
image=$sourceImage
|
||||||
|
fi
|
||||||
|
|
||||||
|
for repository in ${repositories[@]}
|
||||||
|
do
|
||||||
|
docker tag ${sourceImage}:${existingTag} ${repository}:${image}:${newTag}
|
||||||
|
docker push ${repository}:${image}:${newTag}
|
||||||
|
echo "Pushed ${sourceImage}:${existingTag} to ${repository}:${image}:${newTag}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
0
scripts/waitForAlfrescoToStart.sh
Normal file → Executable file
0
scripts/waitForAlfrescoToStart.sh
Normal file → Executable file
Reference in New Issue
Block a user