summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-08-23 16:48:59 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-08-24 06:28:16 -0700
commitdc3f295a8efaa190e70eef8472f7f6aa012649d3 (patch)
treeb2ee9cfac400092fa7d5b4f3043d8abc70c223f8
parent9d710b45baa253cfca760fe51ecf7fed0a8479e4 (diff)
Refactor docker push script to accept image name
Change-Id: If465a45ac93fca37adf07ca94e5d7ac925a808db Issue-id: CIMAN-23 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
-rw-r--r--jjb/global-macros.yaml10
-rw-r--r--jjb/global-templates-java.yaml3
-rw-r--r--jjb/include-docker-push.sh43
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;