blob: cd88f9d17320aa42e40f94a99821e6c7ad39223b [file] [log] [blame]
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +00001#!/bin/bash
2
Jeremy Phelps48028ab2017-03-28 15:38:24 -05003DOCKER_REPOSITORY="nexus3.onap.org:10003"
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +00004SEARCH="aai-service";
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +00005DATETIME_STAMP=$(date +%Y%m%dT%H%M%S);
Venkata Harish K Kajurda43c212017-03-09 22:17:50 +00006VERSION_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
11if [ -f "$VERSION_FILE" ]; then
12 source $VERSION_FILE;
13 VERSION=$release_version;
14else
15 VERSION=1.1.0;
16fi
17
Venkata Harish K Kajur3512f4d2017-06-02 00:41:50 -040018RELEASE_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$";
Venkata Harish K Kajurda43c212017-03-09 22:17:50 +000019
Jessica Wagantalld5711c72018-03-21 09:59:16 -070020SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}Z;
21STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}Z;
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000022
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000023
Gary Wudc3f2952017-08-23 16:48:59 -070024# Set REPO_PATH variable
25
26if [ ! -z "$DOCKER_IMAGE_NAME" ]; then
Gary Wu44681df2017-08-24 11:43:24 -070027 REPO_PATH=$DOCKER_REPOSITORY/${DOCKER_IMAGE_NAME};
Gary Wu23413952017-08-24 13:16:38 -070028
29 # tag image with nexus3 proxy prefix
30 docker tag ${DOCKER_IMAGE_NAME} $REPO_PATH
Gary Wudc3f2952017-08-23 16:48:59 -070031elif [[ $PROJECT =~ $SEARCH ]] ; then
sblimkie0df9fa12017-10-19 17:49:03 +030032 REPO_PATH=$DOCKER_REPOSITORY/onap/ajsc-aai;
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000033else
Venkata Harish K Kajur5d28ee82017-02-24 14:28:27 +000034 # Cut the prefix aai/ in example aai/model-loader
35 DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-);
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000036
sblimkie0df9fa12017-10-19 17:49:03 +030037 REPO_PATH=$DOCKER_REPOSITORY/onap/${DOCKER_REPO_NAME};
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000038fi
Gary Wudc3f2952017-08-23 16:48:59 -070039
40
41docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG;
42docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG;
43
44if [[ "$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;
48else
49 docker push $REPO_PATH:latest;
50fi
51
52docker push $REPO_PATH:$SNAPSHOT_TAG;
53docker push $REPO_PATH:$STAGING_TAG;