Yuta HIGUCHI | 4e751d0 | 2018-05-11 10:22:11 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
Ray Milkey | 0caba7f | 2018-01-08 12:56:18 -0800 | [diff] [blame] | 2 | |
| 3 | # exit on errors |
| 4 | set -eu -o pipefail |
| 5 | |
Ray Milkey | e3f9ad4 | 2018-01-08 14:21:44 -0800 | [diff] [blame] | 6 | DOCKER="/usr/bin/docker" |
| 7 | ${DOCKER} --version |
| 8 | |
Ray Milkey | 0caba7f | 2018-01-08 12:56:18 -0800 | [diff] [blame] | 9 | # set up ONOS build environment |
| 10 | ONOS_ROOT=`pwd` |
| 11 | . tools/build/envDefaults |
| 12 | |
Ray Milkey | 4840a30 | 2018-01-08 16:11:02 -0800 | [diff] [blame] | 13 | # set up release build credentials |
| 14 | . onos-build-credentials |
| 15 | |
Ray Milkey | 545efe9 | 2018-01-26 10:41:00 -0800 | [diff] [blame] | 16 | # get the sources |
Ray Milkey | 0caba7f | 2018-01-08 12:56:18 -0800 | [diff] [blame] | 17 | git checkout $GERRIT_BRANCH |
Andrea Campanella | 79b747c | 2021-08-27 12:07:24 +0200 | [diff] [blame] | 18 | if [[ $ONOS_TAG != *"latest"* ]]; then |
| 19 | git checkout -b docker $ONOS_TAG |
| 20 | fi |
Ray Milkey | 0caba7f | 2018-01-08 12:56:18 -0800 | [diff] [blame] | 21 | |
Andrea Campanella | b889b92 | 2021-09-10 15:19:35 +0200 | [diff] [blame^] | 22 | if [[ $ONOS_TAG == "onos-"* ]]; then |
| 23 | ONOS_TAG=${ONOS_TAG#"onos-"} |
| 24 | fi |
| 25 | |
Ray Milkey | c0d2236 | 2018-01-08 13:51:07 -0800 | [diff] [blame] | 26 | # build and deploy the Docker image |
Ray Milkey | b40e567 | 2018-01-26 10:10:45 -0800 | [diff] [blame] | 27 | $DOCKER build -t onosproject/onos:${ONOS_TAG} . |
Ray Milkey | c0d2236 | 2018-01-08 13:51:07 -0800 | [diff] [blame] | 28 | $DOCKER login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD} |
Ray Milkey | b40e567 | 2018-01-26 10:10:45 -0800 | [diff] [blame] | 29 | $DOCKER push onosproject/onos:${ONOS_TAG} |