blob: 57a0264bbc29fb8c1768ff15131170702fc20eec [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
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000020SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP};
21STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP};
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000022
23if [[ $PROJECT =~ $SEARCH ]] ; then
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000024
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 Kajur3512f4d2017-06-02 00:41:50 -040030 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 Kajurbf07d0a2017-03-26 11:58:15 +000034 else
35 docker push $REPO_PATH:latest;
36 fi
37
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000038 docker push $REPO_PATH:$STAGING_TAG;
39 docker push $REPO_PATH:$SNAPSHOT_TAG;
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000040else
Venkata Harish K Kajur5d28ee82017-02-24 14:28:27 +000041 # Cut the prefix aai/ in example aai/model-loader
42 DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-);
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000043
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 Kajur3512f4d2017-06-02 00:41:50 -040049 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 Kajurbf07d0a2017-03-26 11:58:15 +000053 else
54 docker push $REPO_PATH:latest;
55 fi
56
Venkata Harish K Kajure4e19172017-03-07 07:04:28 +000057 docker push $REPO_PATH:$SNAPSHOT_TAG;
58 docker push $REPO_PATH:$STAGING_TAG;
Venkata Harish K Kajurbaaef362017-02-20 15:42:02 +000059fi