Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Jeremy Phelps | 48028ab | 2017-03-28 15:38:24 -0500 | [diff] [blame] | 3 | DOCKER_REPOSITORY="nexus3.onap.org:10003" |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 4 | SEARCH="aai-service"; |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 5 | DATETIME_STAMP=$(date +%Y%m%dT%H%M%S); |
Venkata Harish K Kajur | da43c21 | 2017-03-09 22:17:50 +0000 | [diff] [blame] | 6 | VERSION_FILE="version.properties" |
| 7 | |
| 8 | # Check for the version file |
| 9 | # If it exists, load the version from that file |
| 10 | # If not found, then use the current version as 1.1.0 for docker images |
| 11 | if [ -f "$VERSION_FILE" ]; then |
| 12 | source $VERSION_FILE; |
| 13 | VERSION=$release_version; |
| 14 | else |
| 15 | VERSION=1.1.0; |
| 16 | fi |
| 17 | |
Venkata Harish K Kajur | 3512f4d | 2017-06-02 00:41:50 -0400 | [diff] [blame] | 18 | RELEASE_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$"; |
Venkata Harish K Kajur | da43c21 | 2017-03-09 22:17:50 +0000 | [diff] [blame] | 19 | |
Jessica Wagantall | d5711c7 | 2018-03-21 09:59:16 -0700 | [diff] [blame] | 20 | SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}Z; |
| 21 | STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}Z; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 22 | |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 23 | |
Gary Wu | dc3f295 | 2017-08-23 16:48:59 -0700 | [diff] [blame] | 24 | # Set REPO_PATH variable |
| 25 | |
| 26 | if [ ! -z "$DOCKER_IMAGE_NAME" ]; then |
Gary Wu | 44681df | 2017-08-24 11:43:24 -0700 | [diff] [blame] | 27 | REPO_PATH=$DOCKER_REPOSITORY/${DOCKER_IMAGE_NAME}; |
Gary Wu | 2341395 | 2017-08-24 13:16:38 -0700 | [diff] [blame] | 28 | |
| 29 | # tag image with nexus3 proxy prefix |
| 30 | docker tag ${DOCKER_IMAGE_NAME} $REPO_PATH |
Gary Wu | dc3f295 | 2017-08-23 16:48:59 -0700 | [diff] [blame] | 31 | elif [[ $PROJECT =~ $SEARCH ]] ; then |
sblimkie | 0df9fa1 | 2017-10-19 17:49:03 +0300 | [diff] [blame] | 32 | REPO_PATH=$DOCKER_REPOSITORY/onap/ajsc-aai; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 33 | else |
Venkata Harish K Kajur | 5d28ee8 | 2017-02-24 14:28:27 +0000 | [diff] [blame] | 34 | # Cut the prefix aai/ in example aai/model-loader |
| 35 | DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-); |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 36 | |
sblimkie | 0df9fa1 | 2017-10-19 17:49:03 +0300 | [diff] [blame] | 37 | REPO_PATH=$DOCKER_REPOSITORY/onap/${DOCKER_REPO_NAME}; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 38 | fi |
Gary Wu | dc3f295 | 2017-08-23 16:48:59 -0700 | [diff] [blame] | 39 | |
| 40 | |
| 41 | docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; |
| 42 | docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; |
| 43 | |
| 44 | if [[ "$VERSION" =~ $RELEASE_VERSION_REGEX ]]; then |
| 45 | STRIPPED_RELEASE=$(echo $VERSION | cut -d"." -f1,2); |
| 46 | docker tag $REPO_PATH:latest $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
| 47 | docker push $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
| 48 | else |
| 49 | docker push $REPO_PATH:latest; |
| 50 | fi |
| 51 | |
| 52 | docker push $REPO_PATH:$SNAPSHOT_TAG; |
| 53 | docker push $REPO_PATH:$STAGING_TAG; |