This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Build only images when needed (#755)
* Build only images when needed * Fix env var
- Loading branch information
1 parent
63e9a09
commit b61f3a0
Showing
2 changed files
with
61 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
TARGET=${1:?} | ||
|
||
function push() { | ||
local image=${1:?} | ||
if [[ -n "$DOCKER_USERNAME" && -n "$DOCKER_PASSWORD" ]]; then | ||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" | ||
docker push $image | ||
fi | ||
} | ||
|
||
case "${TARGET}" in | ||
"controller-image") | ||
image=${CONTROLLER_IMAGE:?} | ||
docker pull $image || make $TARGET CONTROLLER_IMAGE=$image | ||
push $image | ||
;; | ||
"kafka-controller-image") | ||
image=${KAFKA_CONTROLLER_IMAGE:?} | ||
docker pull $image || make $TARGET KAFKA_CONTROLLER_IMAGE=$image | ||
push $image | ||
;; | ||
"nats-controller-image") | ||
image=${NATS_CONTROLLER_IMAGE:?} | ||
docker pull $image || make $TARGET NATS_CONTROLLER_IMAGE=$image | ||
push $image | ||
;; | ||
"function-image-builder") | ||
image=${FUNCTION_IMAGE_BUILDER:?} | ||
docker pull $image || make $TARGET FUNCTION_IMAGE_BUILDER=$image | ||
push $image | ||
;; | ||
"default") | ||
echo "Unsupported target" | ||
exit 1 | ||
esac |