1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/docker/deploy-images.sh
Jonah Graham 84b5a4c3ea Add a version of Dockerfiles with node included for cdt-gdb-adapter
This is a convenience for our sister project, eclipse-cdt-cloud,
that are relying on CDT's infrastructure to do some testing.

See https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/blob/main/src/integration-tests/README.md#running-the-tests-using-docker
2024-09-24 10:19:00 -04:00

38 lines
1.4 KiB
Bash
Executable file

#!/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)
images="cdt-infra-eclipse-full:ubuntu-18.04 cdt-infra-plus-eclipse-install:ubuntu-18.04 cdt-infra-plus-eclipse-install-github:ubuntu-18.04 cdt-infra-plus-node:ubuntu-18.04"
$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,:.*,,)
find $toplevel -name \*\.Jenkinsfile -or -name \*\.yaml -or -name \*\.yml | while read file; do
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!"