-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(push-script): updating the push-script for release (#11)
Signed-off-by: shubhamchaudhary <[email protected]>
- Loading branch information
1 parent
6871b19
commit 23d976c
Showing
3 changed files
with
35 additions
and
15 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
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 |
---|---|---|
@@ -1,14 +1,37 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
IMAGEID=$( docker images -q litmuschaos/chaos-test ) | ||
if [ -z "${REPONAME}" ] | ||
then | ||
REPONAME="litmuschaos" | ||
fi | ||
|
||
if [ ! -z "${DNAME}" ] && [ ! -z "${DPASS}" ]; | ||
if [ -z "${IMGNAME}" ] || [ -z "${IMGTAG}" ]; | ||
then | ||
docker login -u "${DNAME}" -p "${DPASS}"; | ||
#Push to docker hub repository with latest tag | ||
docker tag ${IMAGEID} litmuschaos/chaos-test:latest | ||
docker push litmuschaos/chaos-test:latest; | ||
echo "Image details are missing. Nothing to push."; | ||
exit 1 | ||
fi | ||
|
||
IIMAGEID=$( sudo docker images -q ${REPONAME}/${IMGNAME}:${IMGTAG} ) | ||
|
||
if [ ! -z "${DNAME}" ] && [ ! -z "${DPASS}" ]; | ||
then | ||
sudo docker login -u "${DNAME}" -p "${DPASS}"; | ||
# Push image to docker hub | ||
echo "Pushing ${REPONAME}/${IMGNAME}:${IMGTAG} ..."; | ||
sudo docker push ${REPONAME}/${IMGNAME}:${IMGTAG} ; | ||
if [ ! -z "${TRAVIS_TAG}" ] ; | ||
then | ||
# Push with different tags if tagged as a release | ||
# When github is tagged with a release, then Travis will | ||
# set the release tag in env TRAVIS_TAG | ||
echo "Pushing ${REPONAME}/${IMGNAME}:${TRAVIS_TAG} ..."; | ||
sudo docker tag ${IMAGEID} ${REPONAME}/${IMGNAME}:${TRAVIS_TAG} | ||
sudo docker push ${REPONAME}/${IMGNAME}:${TRAVIS_TAG}; | ||
echo "Pushing ${REPONAME}/${IMGNAME}:latest ..."; | ||
sudo docker tag ${IMAGEID} ${REPONAME}/${IMGNAME}:latest | ||
sudo docker push ${REPONAME}/${IMGNAME}:latest; | ||
fi; | ||
else | ||
echo "No docker credentials provided. Skip uploading litmuschaos/chaostest:latest to docker hub"; | ||
echo "No docker credentials provided. Skip uploading ${REPONAME}/${IMGNAME}:${IMGTAG} to docker hub"; | ||
fi; |