From 4a7078bec1aa87ee267065b56d6291bb6d7d44e9 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 3 Aug 2023 19:46:02 +0200 Subject: [PATCH 1/3] 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 00000000..5a6a46c2 --- /dev/null +++ b/.github/fiware/image-clone.sh @@ -0,0 +1,32 @@ +set -e + +SOURCE="orchestracities/quantumleap" +DOCKER_TARGET="fiware/quantum-leap" +QUAY_TARGET="quay.io/fiware/quantumleap" + +# 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 From b5184d0c8faeaf19a36b245e0b0b0c538647db38 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 3 Aug 2023 19:56:38 +0200 Subject: [PATCH 2/3] Add push --- .github/fiware/image-clone.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh index 5a6a46c2..7d8f3ce6 100755 --- a/.github/fiware/image-clone.sh +++ b/.github/fiware/image-clone.sh @@ -13,6 +13,7 @@ function clone { echo 'cloning from '"$1 $2"' to '"$3" docker pull -q "$1":"$2" docker tag "$1":"$2" "$3":"$2" + docker push -q "$3":"$2" if ! [ -z "$4" ]; then echo 'pushing '"$1 $2"' to latest' From a788f0e7d5d4aaa0ed533b11b7a79937f3a0eeae Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 4 Aug 2023 13:55:47 +0200 Subject: [PATCH 3/3] Add clean --- .github/fiware/image-clone.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/fiware/image-clone.sh b/.github/fiware/image-clone.sh index 7d8f3ce6..99966797 100755 --- a/.github/fiware/image-clone.sh +++ b/.github/fiware/image-clone.sh @@ -31,3 +31,9 @@ for i in "$@" ; do fi echo "" done + +for i in "$@" ; do + if [[ $i == "clean" ]]; then + docker rmi -f $(docker images -a -q) | true + fi +done