Start using foreman scripts from OPNFV repo
[releng.git] / jjb / genesis / genesis-foreman.yml
index c63b423..b87806e 100644 (file)
@@ -9,6 +9,7 @@
         - 'genesis-foreman-verify'
         - 'genesis-foreman-merge'
         - 'genesis-foreman-daily-{stream}'
+        - 'genesis-foreman-deploy'
 
     # stream:    branch with - in place of / (eg. stable-helium)
     # branch:    branch (eg. stable/helium)
         - 'foreman-daily-master'
 
 
+- job-template:
+    name: 'genesis-foreman-deploy'
+
+    project-type: freestyle
+
+    node: opnfv-jump-2
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    parameters:
+    parameters:
+        - string:
+            name: GIT_BASE
+            default: https://gerrit.opnfv.org/gerrit/genesis
+            description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
+        - string:
+            name: GERRIT_BRANCH
+            default: origin/master
+            description: "Branch to build, deploy and test."
+        - string:
+            name: GERRIT_REFSPEC
+            default: refs/heads/master
+            description: "Refspec to retrieve."
+        - string:
+            name: GS_URL
+            default: 'artifacts.opnfv.org/genesis/fuel'
+            description: "URL to Google Storage."
+        - string:
+            name: BUILD_DIRECTORY
+            default: $WORKSPACE/build_output
+            description: "Directory where the build artifact will be located upon the completion of the build."
+
+    scm:
+        - git:
+            skip-tag: true
+            url: $GIT_BASE
+            branches:
+                - $GERRIT_BRANCH
+            refspec: $GERRIT_REFSPEC
+
+    builders:
+        - 'foreman-deploy'
+
 ########################
 # builder macros
 ########################
                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$BUILD_ID.iso"
+                echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum opnfv-$ARTIFACT_VERSION.iso | cut -d' ' -f1)"
                 echo "OPNFV_BUILD_URL=$BUILD_URL"
                 echo "OPNFV_BUILD=OK"
             ) > opnfv-$BUILD_ID.properties
             # remove the BUILD_DIRECTORY and downlaoded artifact to reclaim some space
             /bin/rm -rf $BUILD_DIRECTORY
             /bin/rm -rf $WORKSPACE/opnfv.iso
+
+- builder:
+    name: foreman-deploy
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+            set -x
+
+            cd $WORKSPACE
+
+            # cleanup first
+            sudo $WORKSPACE/foreman/ci/clean.sh -base_config $WORKSPACE/foreman/ci/inventory/lf_pod2_ksgen_settings.yml
+
+            # and then initiate deployment
+            sudo $WORKSPACE/foreman/ci/deploy.sh -base_config $WORKSPACE/foreman/ci/inventory/lf_pod2_ksgen_settings.yml