3 DOCKER_REPOSITORY="nexus3.onap.org:10003"
5 DATETIME_STAMP=$(date +%Y%m%dT%H%M%S);
6 VERSION_FILE="version.properties"
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
13 VERSION=$release_version;
18 RELEASE_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$";
20 SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}Z;
21 STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}Z;
24 # Set REPO_PATH variable
26 if [ ! -z "$DOCKER_IMAGE_NAME" ]; then
27 REPO_PATH=$DOCKER_REPOSITORY/${DOCKER_IMAGE_NAME};
29 # tag image with nexus3 proxy prefix
30 docker tag ${DOCKER_IMAGE_NAME} $REPO_PATH
31 elif [[ $PROJECT =~ $SEARCH ]] ; then
32 REPO_PATH=$DOCKER_REPOSITORY/onap/ajsc-aai;
34 # Cut the prefix aai/ in example aai/model-loader
35 DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-);
37 REPO_PATH=$DOCKER_REPOSITORY/onap/${DOCKER_REPO_NAME};
41 docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG;
42 docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG;
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;
49 docker push $REPO_PATH:latest;
52 docker push $REPO_PATH:$SNAPSHOT_TAG;
53 docker push $REPO_PATH:$STAGING_TAG;