Deploy nolabs website to prod upon change-merged

Change-Id: I3675d896b2d136c4c2e976eef74a0edd00e93554
diff --git a/jjb/nolabs/merge.sh b/jjb/nolabs/merge.sh
new file mode 100644
index 0000000..f1788e4
--- /dev/null
+++ b/jjb/nolabs/merge.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cd $WORKSPACE
+echo "Info: Cleaning the previous deployment"
+echo "-------------------------------------------------------------------------"
+./stop.sh
+echo "-------------------------------------------------------------------------"
+echo "Info: Deploying the new version of nolabs"
+echo "-------------------------------------------------------------------------"
+./start.sh
+echo "-------------------------------------------------------------------------"
+echo "Info: Deployment successful!"
diff --git a/jjb/nolabs/nolabs-jobs.yaml b/jjb/nolabs/nolabs-jobs.yaml
index ec92328..d4edb74 100644
--- a/jjb/nolabs/nolabs-jobs.yaml
+++ b/jjb/nolabs/nolabs-jobs.yaml
@@ -29,6 +29,7 @@
 
     jobs:
       - 'nolabs-verify-{stream}'
+      - 'nolabs-merge-{stream}'
 
 - job-template:
     name: 'nolabs-verify-{stream}'
@@ -95,6 +96,59 @@
 
     builders:
       - shell:
-          !include-raw-escape: ./verify-build.sh
+          !include-raw-escape: ./verify.sh
+
+- job-template:
+    name: 'nolabs-merge-{stream}'
+
+    concurrent: false
+
+    parameters:
+      - project-parameters:
+          project: '{project}'
+          branch: '{branch}'
+      - nordix-gerrit-parameters
+      - label:
+          name: SLAVE_LABEL
+          default: 'nolabs'
+          description: 'Slave label to schedule this job on.'
+
+    properties:
+      - logrotate
+      - build-blocker:
+          use-build-blocker: true
+          blocking-jobs:
+            - 'nolabs-.*'
+          block-level: 'NODE'
+      - throttle:
+          max-per-node: 1
+          max-total: 1
+          option: project
+
+    wrappers:
+      - build-timeout:
+          timeout: 10
+      - fix-workspace-permissions
+
+    scm:
+      - git-scm:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{branch}'
+          refspec: ''
+          wipe_workspace: true
+          clean_before: false
+
+    triggers:
+      - nordix-gerrit-trigger-change-merged:
+          project: '{project}'
+          branch: '{branch}'
+          files: 'jjb/**'
+
+    wrappers:
+      - nordixinfra-jjb-creds-wrapper
+
+    builders:
+      - shell:
+          !include-raw-escape: ./merge.sh
 
 # vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/nolabs/verify-build.sh b/jjb/nolabs/verify.sh
similarity index 76%
rename from jjb/nolabs/verify-build.sh
rename to jjb/nolabs/verify.sh
index 5761f81..4c3745f 100644
--- a/jjb/nolabs/verify-build.sh
+++ b/jjb/nolabs/verify.sh
@@ -6,9 +6,9 @@
 
 cd $WORKSPACE
 app=nolabs-verify-${BUILD_ID}
-echo "Building the container image nolabs-verify-${BUILD_ID}"
+echo "Info: Building the container image nolabs-verify-${BUILD_ID}"
 echo "-------------------------------------------------------------------------"
 docker build -t $app .
 echo "-------------------------------------------------------------------------"
-echo "Build successful!"
+echo "Info: Build successful!"
 docker rmi -f $app > /dev/null