X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=jjb%2Finclude-docker-push.sh;h=cd88f9d17320aa42e40f94a99821e6c7ad39223b;hb=c03571cc11b229da8a9010398a5e351d0b956b4a;hp=1017d549cef37d651f13ba1e5b72f332faaf2dc5;hpb=baaef367a357915ff05a8a401b257e7db0903fb7;p=ci-management.git diff --git a/jjb/include-docker-push.sh b/jjb/include-docker-push.sh old mode 100644 new mode 100755 index 1017d549c..cd88f9d17 --- a/jjb/include-docker-push.sh +++ b/jjb/include-docker-push.sh @@ -1,10 +1,53 @@ #!/bin/bash -DOCKER_REPOSITORY="nexus3.openecomp.org:10003" +DOCKER_REPOSITORY="nexus3.onap.org:10003" SEARCH="aai-service"; +DATETIME_STAMP=$(date +%Y%m%dT%H%M%S); +VERSION_FILE="version.properties" -if [[ $PROJECT =~ $SEARCH ]] ; then - docker push $DOCKER_REPOSITORY/ecomp/ajsc-aai:latest; +# Check for the version file +# If it exists, load the version from that file +# If not found, then use the current version as 1.1.0 for docker images +if [ -f "$VERSION_FILE" ]; then + source $VERSION_FILE; + VERSION=$release_version; else - docker push $DOCKER_REPOSITORY/ecomp/model-loader:latest; + VERSION=1.1.0; fi + +RELEASE_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$"; + +SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}Z; +STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}Z; + + +# Set REPO_PATH variable + +if [ ! -z "$DOCKER_IMAGE_NAME" ]; then + REPO_PATH=$DOCKER_REPOSITORY/${DOCKER_IMAGE_NAME}; + + # tag image with nexus3 proxy prefix + docker tag ${DOCKER_IMAGE_NAME} $REPO_PATH +elif [[ $PROJECT =~ $SEARCH ]] ; then + REPO_PATH=$DOCKER_REPOSITORY/onap/ajsc-aai; +else + # Cut the prefix aai/ in example aai/model-loader + DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-); + + REPO_PATH=$DOCKER_REPOSITORY/onap/${DOCKER_REPO_NAME}; +fi + + +docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; +docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; + +if [[ "$VERSION" =~ $RELEASE_VERSION_REGEX ]]; then + STRIPPED_RELEASE=$(echo $VERSION | cut -d"." -f1,2); + docker tag $REPO_PATH:latest $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; + docker push $REPO_PATH:${STRIPPED_RELEASE}-STAGING-latest; +else + docker push $REPO_PATH:latest; +fi + +docker push $REPO_PATH:$SNAPSHOT_TAG; +docker push $REPO_PATH:$STAGING_TAG;