From e8c0fdab953e8ace9ab8540b0df78e5ea832f4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= Date: Fri, 9 Feb 2018 14:24:14 +0100 Subject: [PATCH] Push image build in from PR --- Makefile | 3 ++- cico_build_deploy.sh | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 86a2947..537fd49 100644 --- a/Makefile +++ b/Makefile @@ -45,9 +45,10 @@ push: image ## Pushes the container image to the registry $(call check_defined, REGISTRY_USER, "You need to pass the registry user via REGISTRY_USER.") $(call check_defined, REGISTRY_PASSWORD, "You need to pass the registry password via REGISTRY_PASSWORD.") docker login -u $(REGISTRY_USER) -p $(REGISTRY_PASSWORD) $(REGISTRY_URI) - docker push $(REGISTRY_URL):latest + [ -n "$(LATEST)" ] && docker push $(REGISTRY_URL):latest docker tag $(REGISTRY_URL):latest $(REGISTRY_URL):$(IMAGE_TAG) docker push $(REGISTRY_URL):$(IMAGE_TAG) + echo "Pushed: $(REGISTRY_URL):$(IMAGE_TAG)" tools: tools.timestamp diff --git a/cico_build_deploy.sh b/cico_build_deploy.sh index 3485f6d..5c5c699 100644 --- a/cico_build_deploy.sh +++ b/cico_build_deploy.sh @@ -12,7 +12,7 @@ set -e # None ################################################################################### function setup_build_environment() { - [ -f jenkins-env ] && cat jenkins-env | grep -e GIT -e DEVSHIFT -e JOB_NAME > inherit-env + [ -f jenkins-env ] && cat jenkins-env | grep -e GIT -e DEVSHIFT -e JOB_NAME -e ghprbPullId > inherit-env [ -f inherit-env ] && . inherit-env # We need to disable selinux for now, XXX @@ -63,5 +63,8 @@ make all if [[ "$JOB_NAME" = "devtools-fabric8-jenkins-proxy-build-master" ]]; then TAG=$(echo ${GIT_COMMIT} | cut -c1-${DEVSHIFT_TAG_LEN}) + make push REGISTRY_USER=${DEVSHIFT_USERNAME} REGISTRY_PASSWORD=${DEVSHIFT_PASSWORD} IMAGE_TAG=${TAG} LATEST=true +elif [[ "$JOB_NAME" = "devtools-fabric8-jenkins-proxy" ]]; then + TAG="PR${ghprbPullId}" make push REGISTRY_USER=${DEVSHIFT_USERNAME} REGISTRY_PASSWORD=${DEVSHIFT_PASSWORD} IMAGE_TAG=${TAG} -fi +fi \ No newline at end of file