From 4e3826eefcecc743d9398b1615429db85dc5157b Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 24 Jul 2023 13:01:20 +0200 Subject: [PATCH] Add webhook bash script --- .github/fiware/image-clone.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 .github/fiware/image-clone.sh diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh new file mode 100755 index 000000000..e30d49e71 --- /dev/null +++ b/.github/fiware/image-clone.sh @@ -0,0 +1,32 @@ +set -e + +SOURCE="telefonicaiot/fiware-cygnus" +DOCKER_TARGET="fiware/cygnus-ngsi" +QUAY_TARGET="quay.io/fiware/cygnus-ngsi" + +# DOCKER_TARGET="fiware/$(basename $(git rev-parse --show-toplevel))" +# QUAY_TARGET="quay.io/fiware/$(basename $(git rev-parse --show-toplevel))" + +VERSION=$(git describe --exclude 'FIWARE*' --tags $(git rev-list --tags --max-count=1)) + +function clone { + echo 'cloning from '"$1 $2"' to '"$3" + docker pull -q "$1":"$2" + docker tag "$1":"$2" "$3":"$2" + + if ! [ -z "$4" ]; then + echo 'pushing '"$1 $2"' to latest' + docker tag "$1":"$2" "$3":latest + docker push -q "$3":latest + fi +} + +for i in "$@" ; do + if [[ $i == "docker" ]]; then + clone "$SOURCE" "$VERSION" "$DOCKER_TARGET" true + fi + if [[ $i == "quay" ]]; then + clone "$SOURCE" "$VERSION" "$QUAY_TARGET" true + fi + echo "" +done \ No newline at end of file