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 | |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 20 | SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}; |
| 21 | STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 22 | |
| 23 | if [[ $PROJECT =~ $SEARCH ]] ; then |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 24 | |
| 25 | REPO_PATH=$DOCKER_REPOSITORY/openecomp/ajsc-aai; |
| 26 | |
| 27 | docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; |
| 28 | docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; |
| 29 | |
Venkata Harish K Kajur | 3512f4d | 2017-06-02 00:41:50 -0400 | [diff] [blame] | 30 | if [[ "$VERSION" =~ $RELEASE_VERSION_REGEX ]]; then |
| 31 | STRIPPED_RELEASE=$(echo $VERSION | cut -d"." -f1,2); |
| 32 | docker tag $REPO_PATH:latest $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
| 33 | docker push $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
Venkata Harish K Kajur | bf07d0a | 2017-03-26 11:58:15 +0000 | [diff] [blame] | 34 | else |
| 35 | docker push $REPO_PATH:latest; |
| 36 | fi |
| 37 | |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 38 | docker push $REPO_PATH:$STAGING_TAG; |
| 39 | docker push $REPO_PATH:$SNAPSHOT_TAG; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 40 | else |
Venkata Harish K Kajur | 5d28ee8 | 2017-02-24 14:28:27 +0000 | [diff] [blame] | 41 | # Cut the prefix aai/ in example aai/model-loader |
| 42 | DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-); |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 43 | |
| 44 | REPO_PATH=$DOCKER_REPOSITORY/openecomp/${DOCKER_REPO_NAME}; |
| 45 | |
| 46 | docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; |
| 47 | docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; |
| 48 | |
Venkata Harish K Kajur | 3512f4d | 2017-06-02 00:41:50 -0400 | [diff] [blame] | 49 | if [[ "$VERSION" =~ $RELEASE_VERSION_REGEX ]]; then |
| 50 | STRIPPED_RELEASE=$(echo $VERSION | cut -d"." -f1,2); |
| 51 | docker tag $REPO_PATH:latest $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
| 52 | docker push $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; |
Venkata Harish K Kajur | bf07d0a | 2017-03-26 11:58:15 +0000 | [diff] [blame] | 53 | else |
| 54 | docker push $REPO_PATH:latest; |
| 55 | fi |
| 56 | |
Venkata Harish K Kajur | e4e1917 | 2017-03-07 07:04:28 +0000 | [diff] [blame] | 57 | docker push $REPO_PATH:$SNAPSHOT_TAG; |
| 58 | docker push $REPO_PATH:$STAGING_TAG; |
Venkata Harish K Kajur | baaef36 | 2017-02-20 15:42:02 +0000 | [diff] [blame] | 59 | fi |