Add post-merge job for snapshot artifacts build and upload

Change-Id: I29c22f52bc31c087401da38cd17f8fe57c7ad9f9
diff --git a/jjb/onos/onos-snapshot-build.sh b/jjb/onos/onos-snapshot-build.sh
new file mode 100644
index 0000000..46ab9ac
--- /dev/null
+++ b/jjb/onos/onos-snapshot-build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+
+# exit on errors
+set -eu -o pipefail
+
+# set up ONOS build environment
+# shellcheck disable=SC2034
+ONOS_ROOT=`pwd`
+. tools/build/envDefaults
+
+PATH=$PATH:/home/jenkins/bin
+
+# import GPG key
+gpg --import jenkins.key
+
+# stage the maven settings
+mkdir -p ~/.m2
+mv settings.xml ~/.m2/settings.xml
+
+# run the build and upload snapshot artifacts
+onos-build-and-upload-snapshot
diff --git a/jjb/onos/onos-verify.yaml b/jjb/onos/onos-verify.yaml
index 0064058..dbb6e03 100644
--- a/jjb/onos/onos-verify.yaml
+++ b/jjb/onos/onos-verify.yaml
@@ -95,7 +95,7 @@
     triggers:
       - timed: '@weekly'
 
-# FIXME - there is a Slack integration plugin in 2.0.3
+    # FIXME - there is a Slack integration plugin in 2.0.3
     publishers:
       - raw:
           xml: |
@@ -122,7 +122,35 @@
               <customMessage/>
             </jenkins.plugins.slack.SlackNotifier>
 
+- post_merge_boiler_plate: &post_merge_boiler_plate
+      name: post_merge_boiler_plate
 
+      scm:
+          - onf-infra-gerrit-scm:
+                git-url: '{git-url}'
+                refspec: '$GERRIT_REFSPEC'
+                branch: '$GERRIT_BRANCH'
+                submodule-disable: '{submodule-disable}'
+                submodule-recursive: '{submodule-recursive}'
+                submodule-timeout: '{submodule-timeout}'
+                choosing-strategy: gerrit
+                jenkins-ssh-credential: '{jenkins-ssh-credential}'
+                basedir: "$WORKSPACE"
+
+      triggers:
+          - gerrit:
+                #server-name: '{gerrit-server-name}'
+                server-name: 'ONOS Project Gerrit'
+                #trigger-on: '{obj:gerrit_verify_triggers}'
+                trigger-on:
+                    - change-merged-event: true
+                projects:
+                    - project-compare-type: PLAIN
+                      project-pattern: '{project}'
+                      branches:
+                          - branch-compare-type: ANT
+                            branch-pattern: '**/{stream}'
+                        #file-paths: '{obj:gerrit_trigger_file_paths}'
 
 - weekly_boiler_plate_with_slack: &weekly_boiler_plate_with_slack
     name: weekly_boiler_plate_with_slack
@@ -240,7 +268,7 @@
 
     # Job template for Java verify jobs
     #
-    # The purpose of this job templte is to run "maven clean install" for
+    # The purpose of this job template is to run "maven clean install" for
     # projects using this template.
     #
     # Required Variables:
@@ -283,7 +311,7 @@
 
     # Job template for Java verify jobs
     #
-    # The purpose of this job templte is to run "maven clean install" for
+    # The purpose of this job template is to run "maven clean install" for
     # projects using this template.
     #
     # Required Variables:
@@ -370,7 +398,7 @@
 
     # Job template for Java verify jobs
     #
-    # The purpose of this job templte is to run "maven clean install" for
+    # The purpose of this job template is to run "maven clean install" for
     # projects using this template.
     #
     # Required Variables:
@@ -391,7 +419,7 @@
 
     # Job template for Java verify jobs
     #
-    # The purpose of this job templte is to run "maven clean install" for
+    # The purpose of this job template is to run "maven clean install" for
     # projects using this template.
     #
     # Required Variables:
@@ -555,6 +583,29 @@
       # JJB 1.6.2 does not support parameter expansion on filename?
       #- shell: !include-raw-escape: {project-name}-verify.sh
 
+- job-template:
+      #default name is global
+      name: 'onos-{stream}-release-build-upload-snapshot'
+
+      # Job template for post-merge snapshot artifacts build and upload
+
+      <<: *job_boiler_plate
+      # yamllint disable-line rule:key-duplicates
+      <<: *post_merge_boiler_plate
+
+      builders:
+          - config-file-provider:
+                files:
+                    - file-id: 'gpg-key'
+                      target: 'jenkins.key'
+                      variable: 'GPG_KEY_FILE'
+
+          #put shell scripts in file then make sure shell check is installed on verify vms
+          - shell: !include-raw-escape: install-bazel.sh
+          - shell: !include-raw-escape: onos-snapshot-build.sh
+          # JJB 1.6.2 does not support parameter expansion on filename?
+          #- shell: !include-raw-escape: {project-name}-verify.sh
+
 - project:
     name: onos
     project-name: onos
@@ -724,3 +775,17 @@
     jobs:
       - 'onos-docker-build'
 
+- project:
+      name: onos-snapshot
+      project-name: onos-snapshot
+      project: onos
+
+      build-timeout: '240'
+      build-node: 'ubuntu16.04-basebuild-8c-15g'
+
+      stream:
+          - 'master'
+
+      jobs:
+          - 'onos-{stream}-release-build-upload-snapshot'
+