-
Andres Maldonado authoredAndres Maldonado authored
get-modified-image.sh 877 B
#!/bin/sh
# Retrieve the name and the version of the image that was modified in the latest commit
# This script should become obsolete as soon as a proper way of getting the modified files is added to Gitlab CI
# Image name, without registry nor tag
RES=""
for i in $(git log -m -1 --name-only --pretty="format:" --first-parent)
do
case "$i" in
*pica*|*meta*)
RES=$(echo $i | cut -d '/' -f1)
break
;;
esac
done
echo "export MODIFIED_IMAGE=${RES}" > variables
# Image name with wanted registry and tag, fetched from Docker Compose
RES=$(cat $RES/docker-compose.yml | grep $RES | cut -d ':' -f2- | cut -d '/' -f2- | tr -d ' ')
if [ "$RES" = "" ]; then exit 1; fi
echo "export MODIFIED_IMAGE_FULL_TEST=registry.test.picasoft.net/${RES}" >> variables
echo "export MODIFIED_IMAGE_FULL=registry.picasoft.net/${RES}" >> variables
echo "Found modified folder : $RES"