Skip to content

Commit

Permalink
Push image build in from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
vpavlin committed Feb 9, 2018
1 parent f63b70e commit 7f149ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 || echo "Not pushing into latest tag"
docker tag $(REGISTRY_URL):latest $(REGISTRY_URL):$(IMAGE_TAG)
docker push $(REGISTRY_URL):$(IMAGE_TAG)
echo "Pushed: $(REGISTRY_URL):$(IMAGE_TAG)"

tools: tools.timestamp

Expand Down
7 changes: 5 additions & 2 deletions cico_build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 7f149ec

Please sign in to comment.