2024-04-26 10:43:40 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
if ! git diff-index HEAD --quiet; then
|
|
|
|
echo "git tree is dirty, please commit changes before deploying images"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
namespace=${1:-quay.io/eclipse-cdt}
|
|
|
|
shorthash=$(git rev-parse --short HEAD)
|
|
|
|
toplevel=$(git rev-parse --show-toplevel)
|
|
|
|
|
2024-12-17 19:00:08 -05:00
|
|
|
images="cdt-infra:latest cdt-infra-jipp:latest cdt-infra-github:latest"
|
2024-04-26 10:43:40 -04:00
|
|
|
|
|
|
|
$toplevel/docker/build-images.sh
|
|
|
|
|
|
|
|
for image in $images; do
|
|
|
|
docker tag $image ${namespace}/${image}-${shorthash}
|
|
|
|
docker push ${namespace}/${image}-${shorthash}
|
|
|
|
nameonly=$(echo $image | sed -es,:.*,,)
|
|
|
|
docker tag $image ${namespace}/${nameonly}:latest
|
|
|
|
docker push ${namespace}/${nameonly}:latest
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "The following images have been pushed."
|
|
|
|
for image in $images; do
|
|
|
|
hashname=$(docker inspect --format='{{index .RepoDigests 0}}' $image)
|
|
|
|
echo $image "-->" $hashname
|
|
|
|
nameonly=$(echo $image | sed -es,:.*,,)
|
2024-06-23 17:23:32 -04:00
|
|
|
find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml -or -name \*\.yml | while read file; do
|
2024-04-26 10:43:40 -04:00
|
|
|
sed -i "s#image: $namespace/$nameonly[:@].*#image: $hashname#" $file
|
|
|
|
git add $file
|
|
|
|
done
|
|
|
|
done
|
|
|
|
echo "Finished pushing to $namespace with tag hash $shorthash"
|
|
|
|
git commit -m"Update images to Dockerfiles from commit $shorthash"
|
|
|
|
echo "The .yaml and .Jenkinsfiles have been updated to new image and committed, now Push!"
|