Skip to content

Commit

Permalink
Merge pull request fabric8-analytics#20 from pkajaba/push-pr-images
Browse files Browse the repository at this point in the history
Start pushing images for PR's
  • Loading branch information
msrb authored Nov 13, 2017
2 parents 4991c14 + 012fe96 commit 9d62106
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions cico_run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build_image

#IMAGE_NAME=$(make get-image-name) ./tests/run_integration_tests.sh

push_image
17 changes: 13 additions & 4 deletions cico_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ tag_push() {
push_image() {
local image_name
local image_repository
local tag
local short_commit
local push_registry
image_name=$(make get-image-name)
image_repository=$(make get-image-repository)
tag=$(git rev-parse --short=7 HEAD)
short_commit=$(git rev-parse --short=7 HEAD)
push_registry="push.registry.devshift.net"

# login first
Expand All @@ -45,8 +45,17 @@ push_image() {
exit 1
fi

tag_push ${push_registry}/${image_repository}:latest ${image_name}
tag_push ${push_registry}/${image_repository}:${tag} ${image_name}
if [ -n "${ghprbPullId}" ]; then
# PR build
pr_id="SNAPSHOT-PR-${ghprbPullId}"
tag_push ${push_registry}/${image_repository}:${pr_id} ${image_name}
tag_push ${push_registry}/${image_repository}:${pr_id}-${short_commit} ${image_name}
else
# master branch build
tag_push ${push_registry}/${image_repository}:latest ${image_name}
tag_push ${push_registry}/${image_repository}:${short_commit} ${image_name}
fi

echo 'CICO: Image pushed, ready to update deployed app'
}

Expand Down

0 comments on commit 9d62106

Please sign in to comment.