voltha-test: pull pipeline-scrips from specific pipeline-branches

* add variable 'pipeline-branch' to all voltha-nightly-job templates
* set default value for 'pipeline-branch' to master (to eventually have
  a very minimal job definition for default pipelines running for
  master)
* move common 'scm' definition block to be job-temaplate specific to
  allow setting the pipeline-branch while instantiating the job
* set value for 'pipeline-branch' explicitly for all active jobs in
  voltha.yml to a branch corresponding the tested release (we might
  remove the explicit setting for 'master' later, since the default is
  already 'master', but it does not hurt to be explicit while
  introducing this new behaviour)

Signed-off-by: Jan Klare <jan.klare@bisdn.de>
Change-Id: I5cbbddf25b84a9ad75430015dbe8b1d322e29044
Signed-off-by: Jan Klare <jan.klare@bisdn.de>
diff --git a/jjb/voltha-test/voltha-nightly-jobs.yaml b/jjb/voltha-test/voltha-nightly-jobs.yaml
index 7e6bf40..1a5d03a 100644
--- a/jjb/voltha-test/voltha-nightly-jobs.yaml
+++ b/jjb/voltha-test/voltha-nightly-jobs.yaml
@@ -1,12 +1,4 @@
 ---
-# define git source for pipeline-scripts used by jenkins job builder
-- scm:
-    name: ci-management
-    scm:
-      - git:
-          url: https://gerrit.opencord.org/ci-management
-          branches:
-            - origin/master
 # list of parameters for the VOLTHA Jobs,
 # used as anchor so that can be shared across multiple jobs
 # to use in a job: `parameters: *voltha-build-job-parameters`
@@ -245,6 +237,7 @@
     release: 'master'
     name-extension: ''
     branch: 'master'
+    pipeline-branch: 'master'
     configurePod: true
     volthaHelmChartsChange: ''
     profile: 'Default'
@@ -262,9 +255,12 @@
     concurrent: true
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
 # -----------------------------------------------------------------------
 # VOLTHA Build Jobs (periodic)
@@ -292,6 +288,7 @@
     release: 'master'
     name-extension: ''
     branch: 'master'
+    pipeline-branch: 'master'
     configurePod: true
     volthaHelmChartsChange: ''
     profile: 'Default'
@@ -309,9 +306,12 @@
     concurrent: true
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - timed: |
@@ -344,6 +344,7 @@
     release: 'master'
     name-extension: ''
     branch: 'master'
+    pipeline-branch: 'master'
     configurePod: true
     volthaHelmChartsChange: ''
     profile: 'Default'
@@ -361,9 +362,12 @@
     concurrent: true
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - timed: |
@@ -387,6 +391,7 @@
 
     <<: *voltha-pipe-job-boiler-plate
     pipeline-script: 'voltha/master/voltha-physical-functional-tests.groovy'
+    pipeline-branch: 'master'
     manifest-url: 'https://gerrit.opencord.org/voltha-test-manifest.git'
     manifest-branch: 'master'
 
@@ -510,9 +515,12 @@
 
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - reverse:
@@ -535,6 +543,7 @@
 
     <<: *voltha-pipe-job-boiler-plate
     pipeline-script: 'voltha/playground/voltha-physical-functional-tests.groovy'
+    pipeline-branch: 'master'
     manifest-url: 'https://gerrit.opencord.org/voltha-test-manifest.git'
     manifest-branch: 'master'
 
@@ -658,9 +667,12 @@
 
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - reverse:
@@ -684,6 +696,7 @@
 
     <<: *voltha-pipe-job-boiler-plate
     pipeline-script: 'voltha/master/voltha-physical-functional-tests.groovy'
+    pipeline-branch: 'master'
     manifest-url: 'https://gerrit.opencord.org/voltha-test-manifest.git'
     manifest-branch: 'master'
 
@@ -800,9 +813,12 @@
 
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - timed: |
@@ -826,6 +842,7 @@
 
     <<: *voltha-pipe-job-boiler-plate
     pipeline-script: 'voltha/master/voltha-physical-functional-tests.groovy'
+    pipeline-branch: 'master'
     manifest-url: 'https://gerrit.opencord.org/voltha-test-manifest.git'
     manifest-branch: 'master'
 
@@ -947,9 +964,12 @@
 
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
 # -----------------------------------------------------------------------
 # VOLTHA DMI Test Job
@@ -980,6 +1000,7 @@
     release: 'master'
     name-extension: ''
     branch: 'master'
+    pipeline-branch: 'master'
     configurePod: true
     volthaHelmChartsChange: ''
     profile: 'Default'
@@ -1192,9 +1213,12 @@
     concurrent: true
     project-type: pipeline
     pipeline-scm:
-      script-path: jjb/pipeline/{pipeline-script}
       scm:
-        - ci-management
+        - git:
+            url: https://gerrit.opencord.org/ci-management
+            branches:
+              - origin/{pipeline-branch}
+      script-path: jjb/pipeline/{pipeline-script}
 
     triggers:
       - timed: |
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index 43dd60c..c475077 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -79,6 +79,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -109,6 +110,7 @@
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           power-switch: true
@@ -136,6 +138,7 @@
           disable-job: true
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           name-extension: '_DT'
           work-flow: 'DT'
           profile: '1T8GEM'
@@ -151,6 +154,7 @@
           disable-job: true
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           name-extension: '_DT'
           work-flow: 'DT'
           profile: '1T8GEM'
@@ -183,6 +187,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           power-switch: true
@@ -197,6 +202,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           power-switch: true
@@ -227,6 +233,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           profile: '1T8GEM'
           num-of-onos: '3'
           num-of-atomix: '3'
@@ -242,6 +249,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           profile: '1T8GEM'
           num-of-onos: '3'
           num-of-atomix: '3'
@@ -270,6 +278,7 @@
           disable-job: true
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -284,6 +293,7 @@
           disable-job: true
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -316,6 +326,7 @@
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: '1T4GEM-FTTB'
           power-switch: true
@@ -331,6 +342,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           profile: '1T4GEM-FTTB'
           num-of-onos: '3'
           num-of-atomix: '3'
@@ -347,6 +359,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           profile: '1T4GEM-FTTB'
           num-of-onos: '3'
           num-of-atomix: '3'
@@ -365,6 +378,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           test-repo: 'voltha-system-tests'
           profile: '1T4GEM-FTTB'
           power-switch: true
@@ -381,6 +395,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           test-repo: 'voltha-system-tests'
           profile: '1T4GEM-FTTB'
           power-switch: true
@@ -395,6 +410,7 @@
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           profile: '1T8GEM'
           reinstall-olt: true
           num-of-onos: '3'
@@ -411,6 +427,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -427,6 +444,7 @@
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           reinstall-olt: true
           num-of-onos: '3'
           num-of-atomix: '3'
@@ -443,6 +461,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -457,6 +476,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           profile: 'TP'
@@ -472,6 +492,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           power-switch: true
@@ -488,6 +509,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           profile: 'TP'
@@ -503,6 +525,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           power-switch: true
@@ -520,6 +543,7 @@
           disable-job: true
           release: 'voltha-2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           name-extension: '_TT'
           work-flow: 'TT'
           profile: 'TP'
@@ -535,6 +559,7 @@
           disable-job: true
           release: 'voltha-2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           name-extension: '_TT'
           work-flow: 'TT'
           profile: 'TP'
@@ -551,6 +576,7 @@
           disable-job: true
           release: 'voltha-2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           name-extension: '_TT'
           work-flow: 'TT'
           power-switch: true
@@ -567,6 +593,7 @@
           disable-job: true
           release: 'voltha-2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           name-extension: '_TT'
           work-flow: 'TT'
           power-switch: true
@@ -583,6 +610,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           profile: 'TP'
@@ -598,6 +626,7 @@
           disable-job: true
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           name-extension: '_TT'
           work-flow: 'TT'
           power-switch: true
@@ -638,6 +667,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           profile: '1T8GEM'
           reinstall-olt: false
           extraHelmFlags: "--set adapter_adtran_olt.kv_store_data_prefix='service/voltha/voltha_voltha' --set network.netconfUserSecret='' --set adapter_adtran_olt.topics.core_topic=voltha_voltha_rwcore"
@@ -659,6 +689,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           profile: '1T8GEM'
           reinstall-olt: false
           extraHelmFlags: "--set adapter_adtran_olt.kv_store_data_prefix='service/voltha/voltha_voltha' --set network.netconfUserSecret='' --set adapter_adtran_olt.topics.core_topic=voltha_voltha_rwcore"
@@ -696,6 +727,7 @@
           disable-job: true
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -712,6 +744,7 @@
           disable-job: true
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -730,6 +763,7 @@
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
+          pipeline-branch: 'master'
           profile: 'Default'
           installVolthaInfra: true
           installVolthaStack: false
@@ -755,6 +789,7 @@
           work-flow: 'DT'
           release: '2.11'
           branch: 'voltha-2.11'
+          pipeline-branch: 'voltha-2.11'
           profile: 'Default'
           installVolthaInfra: true
           installVolthaStack: false
@@ -778,6 +813,7 @@
           work-flow: 'DT'
           release: '2.12'
           branch: 'voltha-2.12'
+          pipeline-branch: 'voltha-2.12'
           profile: 'Default'
           installVolthaInfra: true
           installVolthaStack: false