Store staging and snapshot artifict in same repo 03/47703/3
authorDenes Nemeth <denes.nemeth@nokia.com>
Tue, 15 May 2018 20:12:54 +0000 (22:12 +0200)
committerDenes Nemeth <denes.nemeth@nokia.com>
Wed, 16 May 2018 19:10:37 +0000 (21:10 +0200)
ONAP community is not using the a separate repo for
storing snapshot and staging artifacts. The change
parameterises the docker build to be able to separately
control the target repository and the build artifact type
(snapshot / staging). It will also store the staging and
snapshots in the same repo (10003).

Change-Id: I505023a7cdab90fa8ecfeb540f6306f0e19c3d6d
Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com>
Issue-ID: VFC-728

jjb/global-templates-docker.yaml
shell/docker-build.sh

index 96aed9d..8145efa 100644 (file)
             DOCKER_NAME={docker_name}
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
+            BUILD_MODE=SNAPSHOT
             DOCKERREGISTRY={docker_registry}
       # Do the docker build
       - shell: !include-raw: ../shell/docker-build.sh
             DOCKER_NAME={docker_name}
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
+            BUILD_MODE=SNAPSHOT
             DOCKERREGISTRY={docker_registry}
       # Do the docker build
       - shell: !include-raw: ../shell/docker-build.sh
     #     branch:    git branch (eg. stable/lithium or master)
     <<: *docker_job_boiler_plate
 
-    docker_registry: '$DOCKER_REGISTRY:10004'
+    docker_registry: '$DOCKER_REGISTRY:10003'
 
     scm:
       - lf-infra-gerrit-scm:
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
             DOCKERREGISTRY={docker_registry}
+            BUILD_MODE=STAGING
 
       # Do the docker build
       - shell: !include-raw: ../shell/snapshot-strip.sh
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
             DOCKERREGISTRY={docker_registry}
+            BUILD_MODE=SNAPSHOT
       # Do the docker build
       - shell: !include-raw: ../shell/docker-build.sh
       - inject:
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
             DOCKERREGISTRY={docker_registry}
+            BUILD_MODE=SNAPSHOT
       # Do the docker build
       - shell: !include-raw: ../shell/docker-build.sh
       - inject:
     #     branch:    git branch (eg. stable/lithium or master)
     <<: *docker_job_boiler_plate
 
-    docker_registry: '$DOCKER_REGISTRY:10004'
+    docker_registry: '$DOCKER_REGISTRY:10003'
 
     scm:
       - lf-infra-gerrit-scm:
             DOCKER_ROOT={docker_root}
             DOCKER_TAG={docker_tag}
             DOCKERREGISTRY={docker_registry}
+            BUILD_MODE=STAGING
 
       # Do the docker build
       - shell: !include-raw: ../shell/snapshot-strip.sh
index 080a8b6..1cb71d3 100644 (file)
@@ -6,13 +6,13 @@ set -e -o pipefail
 FULL_DATE=`date +'%Y%m%dT%H%M%S'`
 IMAGE_VERSION=`xmlstarlet sel -N "x=http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml | cut -c1-5`
 
-case "$DOCKERREGISTRY" in
-   "$DOCKER_REGISTRY:10004")
+case "$BUILD_MODE" in
+   "STAGING")
       DOCKER_TAG="$IMAGE_VERSION"-STAGING-"$FULL_DATE"Z
       DOCKER_LATEST_TAG="$IMAGE_VERSION"-STAGING-latest
       echo "Using tags $DOCKER_TAG and $DOCKER_LATEST_TAG"
       ;;
-   "$DOCKER_REGISTRY:10003")
+   "SNAPSHOT")
       DOCKER_TAG="$IMAGE_VERSION"-SNAPSHOT-"$FULL_DATE"Z
       DOCKER_LATEST_TAG="$IMAGE_VERSION"-SNAPSHOT-latest
       echo "Using tags $DOCKER_TAG and $DOCKER_LATEST_TAG"