new job to release docker images 39/1839/4
authorJulienBe <jb379x@att.com>
Wed, 8 Mar 2017 21:07:21 +0000 (13:07 -0800)
committerJulienBe <jb379x@att.com>
Thu, 9 Mar 2017 15:44:11 +0000 (07:44 -0800)
pull docker image from release, tag it, push it to release

Change-Id: I2418b5ae085fe09ed00f7ebaa6ceed4664c236ed
Signed-off-by: JulienBe <jb379x@att.com>
jjb/global-templates-script.yaml
jjb/include-docker-blessing.sh [new file with mode: 0755]
jjb/mso/mso.yaml

index 9058133..3932d07 100644 (file)
 #    publishers:
 #      - ecomp-infra-shiplogs:
 #          maven-version: '{maven-version}'
+
+- job-template:
+    # 1. PULL the desired image
+    # 2. TAG it to the desired release name
+    # 3. PUSH the newly tagged image on release repo
+
+    name: '{project-name}-docker-image-blessing'
+
+    project-type: freestyle
+    concurrent: true
+    node: 'ubuntu1604-docker-2c-1g'
+
+    parameters:
+      - string:
+          name: VERSION
+          description: "VERSION of the STAGING image to bless into this RELEASE VERSION
+            Example : 1.2.3"
+      - string:
+          name: TIMESTAMP
+          description: "TIMESTAMP of the STAGING image to pull
+            Example : 20170308T1332"
+      - string:
+          name: PROJECT
+          default: '{project}'
+
+    properties:
+      - ecomp-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    wrappers:
+      - ecomp-infra-wrappers:
+          build-timeout: '{build-timeout}'
+
+    builders:
+      - provide-maven-settings:
+          global-settings-file: 'global-settings'
+          settings-file: '{mvn-settings}'
+      - docker-login
+      - shell: !include-raw: include-docker-blessing.sh
\ No newline at end of file
diff --git a/jjb/include-docker-blessing.sh b/jjb/include-docker-blessing.sh
new file mode 100755 (executable)
index 0000000..3cb67cf
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+if [ -z "$VERSION" ];
+then
+    echo "Error: no version provided"
+    exit 1
+fi
+
+if [ -z "$TIMESTAMP" ];
+then
+    echo "Error: no timestamp provided"
+    exit 1
+fi
+
+if [ -z "$PROJECT" ];
+then
+    echo "Error: no project provided"
+    exit 1
+fi
+
+RELEASE_REPOSITORY="nexus3.openecomp.org:10002"
+SNAPSHOT_REPOSITORY="nexus3.openecomp.org:10003"
+STAGING_IMAGE="openecomp/$PROJECT:$VERSION-STAGING-$TIMESTAMP"
+RELEASE_IMAGE="openecomp/$PROJECT:$VERSION"
+
+docker pull "$SNAPSHOT_REPOSITORY/$STAGING_IMAGE"
+docker tag "$SNAPSHOT_REPOSITORY/$STAGING_IMAGE" "$RELEASE_REPOSITORY/$RELEASE_IMAGE"
+docker push "$RELEASE_REPOSITORY/$RELEASE_IMAGE"
\ No newline at end of file
index ae78a4d..b577194 100644 (file)
@@ -10,6 +10,7 @@
       - '{project-name}-{stream}-docker-java-daily':
           docker-pom: 'pom.xml'
           mvn-profile: 'docker'
+      - '{project-name}-docker-image-blessing'
 
     project: 'mso'
     stream: