diff options
author | Jessica Wagantall <jwagantall@linuxfoundation.org> | 2017-08-24 18:10:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-08-24 18:10:53 +0000 |
commit | c1c1b251adaa7dbe98030674e87e57c67f4da4b5 (patch) | |
tree | c2efbc82a896f7db13f4b52148b555373185dc37 /jjb | |
parent | 2dc24ff37cfbdfb29d57addc78a5d1e450f3b546 (diff) | |
parent | dc3f295a8efaa190e70eef8472f7f6aa012649d3 (diff) |
Merge "Refactor docker push script to accept image name"
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/global-macros.yaml | 10 | ||||
-rw-r--r-- | jjb/global-templates-java.yaml | 3 | ||||
-rw-r--r-- | jjb/include-docker-push.sh | 43 |
3 files changed, 30 insertions, 26 deletions
diff --git a/jjb/global-macros.yaml b/jjb/global-macros.yaml index 454d056ef..826b6041d 100644 --- a/jjb/global-macros.yaml +++ b/jjb/global-macros.yaml @@ -109,6 +109,16 @@ # yamllint enable description: 'Maven selector to be used by shell scripts' +- parameter: + name: docker-image-name + parameters: + - string: + name: DOCKER_IMAGE_NAME + # yamllint disable rule:line-length + default: '{docker-image-name}' + # yamllint enable + description: 'Docker image name, e.g. onap/appc' + # PROPERTIES - property: name: infra-properties diff --git a/jjb/global-templates-java.yaml b/jjb/global-templates-java.yaml index 21a227b27..23d74c6bc 100644 --- a/jjb/global-templates-java.yaml +++ b/jjb/global-templates-java.yaml @@ -1342,6 +1342,7 @@ name: '{project-name}-{stream}-aai-docker-java-daily' project-type: freestyle node: 'ubuntu1604-docker-8c-8g' + docker-image-name: '' properties: - infra-properties: @@ -1355,6 +1356,8 @@ artifacts: '{archive-artifacts}' - maven-exec: maven-version: '{maven-version}' + - docker-image-name: + docker-image-name: '{docker-image-name}' scm: - gerrit-trigger-scm: diff --git a/jjb/include-docker-push.sh b/jjb/include-docker-push.sh index 57a0264bb..1a89fe72c 100644 --- a/jjb/include-docker-push.sh +++ b/jjb/include-docker-push.sh @@ -20,40 +20,31 @@ RELEASE_VERSION_REGEX="^[0-9]+\.[0-9]+\.[0-9]+$"; SNAPSHOT_TAG=${VERSION}-SNAPSHOT-${DATETIME_STAMP}; STAGING_TAG=${VERSION}-STAGING-${DATETIME_STAMP}; -if [[ $PROJECT =~ $SEARCH ]] ; then - REPO_PATH=$DOCKER_REPOSITORY/openecomp/ajsc-aai; - - docker tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; - docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; +# Set REPO_PATH variable - 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:$STAGING_TAG; - docker push $REPO_PATH:$SNAPSHOT_TAG; +if [ ! -z "$DOCKER_IMAGE_NAME" ]; then + REPO_PATH=$DOCKER_REPOSITORY/${$DOCKER_IMAGE_NAME}; +elif [[ $PROJECT =~ $SEARCH ]] ; then + REPO_PATH=$DOCKER_REPOSITORY/openecomp/ajsc-aai; else # Cut the prefix aai/ in example aai/model-loader DOCKER_REPO_NAME=$(echo ${PROJECT} | cut -d"/" -f2-); REPO_PATH=$DOCKER_REPOSITORY/openecomp/${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 tag $REPO_PATH:latest $REPO_PATH:$STAGING_TAG; +docker tag $REPO_PATH:latest $REPO_PATH:$SNAPSHOT_TAG; - docker push $REPO_PATH:$SNAPSHOT_TAG; - docker push $REPO_PATH:$STAGING_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; |