Merge "[VOL-3813] Update soak/manual build pipeline with new parameters"
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 1af84c8..4e700da 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -480,7 +480,7 @@
           time-trigger: "H H */3 * *"
 
       # Berlin pod with olt/onu - master versions timer based job , two OLTs
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-multi-olt'
           release: 'master'
@@ -494,7 +494,7 @@
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           configurePod: true
           profile: '1T8GEM'
-          time: '21'
+          trigger-after: build_dt-berlin-pod-gpon_1T8GEM_voltha_DT_2.6_test
 
 
       # Berlin POD test job - master versions: uses tech profile on voltha branch
@@ -511,7 +511,7 @@
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
 
       # Berlin pod with olt/onu -  voltha-2.6 timer based job , two OLTs
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-multi-olt'
           release: '2.6'
@@ -525,7 +525,7 @@
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           configurePod: true
           profile: '1T8GEM'
-          time: '13'
+          trigger-after: build_dt-berlin-pod-multi-olt_1T8GEM_voltha_DT_master_test
 
 
       # Berlin POD test job -  voltha-2.6 versions: two OLTs
@@ -542,7 +542,7 @@
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
 
      # Berlin pod with olt/onu - voltha-2.6 Default tech profile and timer based job
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod'
           release: '2.6'
@@ -555,7 +555,7 @@
           configurePod: true
           disable-job: true
           profile: 'Default'
-          time: '17'
+          trigger-after: build_dt-berlin-pod-multi-olt_1T8GEM_voltha_DT_2.6_test
 
 
       # Berlin POD test job - master versions: uses tech profile on voltha branch
@@ -569,7 +569,7 @@
           power-switch: True
 
       # Berlin pod with gpon olt/onu - master 1T8GEM tech profile and timer based job
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-gpon'
           release: 'master'
@@ -583,7 +583,8 @@
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           configurePod: true
           profile: '1T8GEM'
-          time: '1'
+          #update this to use 'build_dt-berlin-pod_Default_voltha_2.6_test' once above job enables
+          trigger-after: build_dt-berlin-pod-multi-olt_1T8GEM_voltha_DT_2.6_test
 
 
       # Berlin POD test job - master versions: uses 1T8GEM tech profile on voltha branch
@@ -600,7 +601,7 @@
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
 
       # Berlin pod with adtran gpon olt/onu - master 1T8GEM tech profile and timer based job
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-gpon-adtran'
           release: '2.6'
@@ -616,7 +617,7 @@
           profile: '1T8GEM'
           reinstall-olt: false
           openoltAdapterChart: '/home/community/adtran-2021-01-29/voltha-adapter-adtran-olt'
-          time: '9'
+          trigger-after: build_dt-berlin-pod-gpon_1T8GEM_voltha_DT_master_test
 
 
       # Berlin POD adtran test job - master versions: uses 1T8GEM tech profile on voltha branch
@@ -634,7 +635,7 @@
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
 
      # Berlin pod with gpon olt/onu - voltha-2.5 1T8GEM tech profile and timer based job
-      - 'build_voltha_pod_release_timer':
+      - 'build_voltha_pod_release_dependent':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-gpon'
           release: '2.6'
@@ -648,7 +649,7 @@
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           configurePod: true
           profile: '1T8GEM'
-          time: '5'
+          trigger-after: build_dt-berlin-pod-gpon-adtran_1T8GEM_voltha_DT_2.6_test
 
 
       # Berlin POD test job - voltha-2.5 versions: uses 1T8GEM tech profile on voltha branch
diff --git a/jjb/pipeline/voltha-scale-multi-stack.groovy b/jjb/pipeline/voltha-scale-multi-stack.groovy
index 22b1549..5a56f29 100644
--- a/jjb/pipeline/voltha-scale-multi-stack.groovy
+++ b/jjb/pipeline/voltha-scale-multi-stack.groovy
@@ -255,12 +255,6 @@
             sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
           fi
 
-          if [ ${withMibTemplate} = true ] ; then
-            rm -f BBSM-12345123451234512345-00000000000001-v1.json
-            wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
-            cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl -n \$INFRA_NS exec -it \$(kubectl -n \$INFRA_NS get pods -l app=etcd | awk 'NR==2{print \$1}') -- etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001
-          fi
-
           if [ ${withPcap} = true ] && [ ${volthaStacks} -eq 1 ] ; then
             # Start the tcp-dump in ofagent
             export OF_AGENT=\$(kubectl -n \$INFRA_NS get pods -l app=ofagent -o name)
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
index 6027cf5..c4cff5a 100644
--- a/jjb/pipeline/voltha/master/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -145,6 +145,20 @@
         loadToKind()
       }
     }
+    stage('Replace voltctl') {
+      // if the project is voltctl override the downloaded one with the built one
+      when {
+        expression {
+          return gerritProject == "voltctl"
+        }
+      }
+      steps{
+        sh """
+        mv `ls $WORKSPACE/voltctl/release/voltctl-*-linux-amd*` $WORKSPACE/bin/voltctl
+        chmod +x $WORKSPACE/bin/voltctl
+        """
+      }
+    }
     stage('Run Test') {
       steps {
         test_workflow("att")
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index a4466e0..92251b2 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -229,7 +229,7 @@
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-att-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
@@ -248,7 +248,7 @@
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-dt-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
@@ -267,7 +267,7 @@
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-tt-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
@@ -362,7 +362,7 @@
           name: 'voltha-scale-measurements-2.6-10-stacks-2-16-32-att-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
@@ -382,7 +382,7 @@
           name: 'voltha-scale-measurements-2.6-10-stacks-2-16-32-dt-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
@@ -402,7 +402,7 @@
           name: 'voltha-scale-measurements-2.6-10-stacks-2-16-32-tt-subscribers'
           build-node: 'voltha-scale-2'
           pipeline-script: 'voltha-scale-multi-stack.groovy'
-          'disable-job': false
+          'disable-job': true
           time-trigger: "H H/4 * * *"
           withMonitoring: false
           logLevel: WARN
diff --git a/jjb/voltha-test/voltha-nightly-jobs.yaml b/jjb/voltha-test/voltha-nightly-jobs.yaml
index 1f1f102..4b3b761 100644
--- a/jjb/voltha-test/voltha-nightly-jobs.yaml
+++ b/jjb/voltha-test/voltha-nightly-jobs.yaml
@@ -220,6 +220,12 @@
       - reverse:
           jobs: '{trigger-after}'
           result: 'success'
+      - reverse:
+          jobs: '{trigger-after}'
+          result: 'failure'
+      - reverse:
+          jobs: '{trigger-after}'
+          result: 'unstable'
 
 # VOLTHA Test Job
 # This job is automatically triggered after a build job has successfully completed
diff --git a/vars/buildVolthaComponent.groovy b/vars/buildVolthaComponent.groovy
index c0e4163..29c9b9c 100644
--- a/vars/buildVolthaComponent.groovy
+++ b/vars/buildVolthaComponent.groovy
@@ -1,12 +1,28 @@
 def call(String project) {
   // project is the gerrit project name
 
-  if (project != 'voltha-system-tests' &&
-    project != 'voltha-helm-charts' &&
-    project != '') {
+  // these are project that are not required to be built
+  def ignoredProjects = [
+    '', // this is the case for a manual trigger on master, nothing to be built
+    'voltha-system-tests',
+    'voltha-helm-charts'
+  ]
+
+  // some projects have different make targets
+  def Map customMakeTargets = [
+    "voltctl": "release"
+  ]
+
+  def defaultMakeTarget = "docker-build"
+
+  if (!ignoredProjects.contains(project)) {
+
+    def makeTarget = customMakeTargets.get(project, defaultMakeTarget)
+
+    println "Building ${project} with make target ${makeTarget}."
 
     sh """
-    make -C $WORKSPACE/${project} DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
+    make -C $WORKSPACE/${project} DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest ${makeTarget}
     """
   } else {
     println "The project ${project} does not require to be built."
diff --git a/vars/createKubernetesCluster.groovy b/vars/createKubernetesCluster.groovy
index fccbaed..f640b16 100644
--- a/vars/createKubernetesCluster.groovy
+++ b/vars/createKubernetesCluster.groovy
@@ -41,9 +41,8 @@
       if [ "\$HOSTARCH" == "x86_64" ]; then
           HOSTARCH="amd64"
       fi
-      curl -Lo ./voltctl https://github.com/opencord/voltctl/releases/download/v1.3.1/voltctl-1.3.1-\$HOSTOS-\$HOSTARCH
-      chmod +x ./voltctl
-      mv ./voltctl $WORKSPACE/bin/
+      curl -Lo $WORKSPACE/bin/voltctl https://github.com/opencord/voltctl/releases/download/v1.3.1/voltctl-1.3.1-\$HOSTOS-\$HOSTARCH
+      chmod +x $WORKSPACE/bin/voltctl
 
       # start the kind cluster
       kind create cluster --name ${cfg.name} --config kind.cfg