Merge "CORD-3058 adding kubespray install script test"
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 7c9857f..b991127 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -26,7 +26,7 @@
 
     # The most frequently used type of build node
     # see other build node types under "Cloud > Amazon EC2" at
-    #  https://jenkins-new.opencord.org/configure
+    #  https://jenkins.opencord.org/configure
     build-node: ubuntu16.04-basebuild-1c-1g
 
     # CORD Gerrit server definition, set in configuration
diff --git a/jjb/pipeline/helm-api-test.groovy b/jjb/pipeline/helm-api-test.groovy
index 7271d7a..e96e566 100644
--- a/jjb/pipeline/helm-api-test.groovy
+++ b/jjb/pipeline/helm-api-test.groovy
@@ -30,9 +30,63 @@
     stage('patch') {
       steps {
         sh """
+           #!/usr/bin/env bash
+           set -eu -o pipefail
+
+           VERSIONFILE="" # file path to file containing version number
+           NEW_VERSION="" # version number found in VERSIONFILE
+           release_version=0
+
+           function read_version {
+             if [ -f "VERSION" ]
+             then
+               NEW_VERSION=\$(head -n1 "VERSION")
+               VERSIONFILE="VERSION"
+             elif [ -f "package.json" ]
+             then
+               NEW_VERSION=\$(python -c 'import json,sys;obj=json.load(sys.stdin); print obj["version"]' < package.json)
+               VERSIONFILE="package.json"
+             else
+               echo "ERROR: No versioning file found!"
+               exit 1
+             fi
+           }
+
+           # check if the version is a released version
+           function check_if_releaseversion {
+             if [[ "\$NEW_VERSION" =~ ^([0-9]+)\\.([0-9]+)\\.([0-9]+)\$ ]]
+             then
+               echo "Version string '\$NEW_VERSION' in '\$VERSIONFILE' is a SemVer released version!"
+               releaseversion=1
+             else
+               echo "Version string '\$NEW_VERSION' in '\$VERSIONFILE' is not a SemVer released version, skipping."
+             fi
+           }
+
            pushd cord
            PROJECT_PATH=\$(xmllint --xpath "string(//project[@name=\\\"${gerritProject}\\\"]/@path)" .repo/manifest.xml)
            repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}"
+
+           pushd \$PROJECT_PATH
+           echo "Existing git tags:"
+           git tag -n
+
+           read_version
+           check_if_releaseversion
+
+           # perform checks if a released version
+           if [ "\$releaseversion" -eq "1" ]
+           then
+             git config --global user.email "apitest@opencord.org"
+             git config --global user.name "API Test"
+
+             git tag -a "\$NEW_VERSION" -m "Tagged for api test on Gerrit patchset: ${gerritChangeNumber}"
+
+             echo "Tags including new tag:"
+             git tag -n
+
+           fi
+           popd
            popd
            """
       }
diff --git a/jjb/pipeline/voltha-atest-provisioning.groovy b/jjb/pipeline/voltha-atest-provisioning.groovy
index ea8d198..bc15b09 100755
--- a/jjb/pipeline/voltha-atest-provisioning.groovy
+++ b/jjb/pipeline/voltha-atest-provisioning.groovy
@@ -9,12 +9,6 @@
 
   stages {
 
-    stage ('Cleanup workspace') {
-        steps {
-        sh 'rm -rf ./build ./component ./incubator ./onos-apps ./orchestration ./test ./.repo'
-        }
-    }
-
     stage('voltha Repo') {
       steps {
         checkout(changelog: false, \
@@ -33,30 +27,26 @@
       }
     }
 
-    stage ('Bring up voltha dev vm') {
-      steps {
-        sh '''
-        pushd $WORKSPACE/cord/incubator/voltha
-        vagrant up voltha
-        popd
-        '''
-        }
-      }
-    stage ('Remove the pre-created venv-linux') {
-      steps {
-        sh 'vagrant ssh -c "rm -rf $WORKSPACE/cord/incubator/voltha/venv-linux"'
-        }
-      }
-
     stage ('Build voltha and onos') {
       steps {
-        sh 'vagrant ssh -c "cd $WORKSPACE/cord/incubator/voltha && source env.sh && make fetch-jenkins && make jenkins && make onos" voltha' }
-        }
+        sh '''
+        cd $WORKSPACE/cord/incubator/voltha
+        source env.sh
+        make fetch
+        make clean
+        make build
+        make onos
+        '''
+      }
+    }
 
     stage ('Start Provisioning Test') {
       steps {
         println 'Start Provisioning Test'
-        sh 'vagrant ssh -c "cd $WORKSPACE/cord/incubator/voltha/tests && pwd" voltha' }
+        println 'Run the following commands when the testing code is in Gerrit'
+        println 'cd tests/atests/'
+        println 'robot -d results -v LOG_DIR:/tmp robot/auto_testing.robot'
       }
     }
+  }
 }
diff --git a/jjb/shell/jflint.sh b/jjb/shell/jflint.sh
index e7b76f0..0972793 100755
--- a/jjb/shell/jflint.sh
+++ b/jjb/shell/jflint.sh
@@ -20,7 +20,7 @@
 
 set -e -u -o pipefail
 
-JENKINS_URL=https://jenkins-new.opencord.org/
+JENKINS_URL=https://jenkins.opencord.org/
 JF_LIST=()
 
 # if no args, and there's a Jenkinsfile in cwd, check it
diff --git a/jjb/verify/exampleservice.yaml b/jjb/verify/exampleservice.yaml
index dea147e..fae36e3 100644
--- a/jjb/verify/exampleservice.yaml
+++ b/jjb/verify/exampleservice.yaml
@@ -6,17 +6,33 @@
     project: '{name}'
 
     jobs:
-      - 'verify-exampleservice-jobs':
+      - 'verify-exampleservice-common':
+          branch-regexp: '{supported-branches-regexp}'
+
+      - 'verify-exampleservice-jobs-modern':
+          branch-regexp: '{modern-branches-regexp}'
+
+      - 'verify-exampleservice-jobs-legacy':
           branch-regexp: '{legacy-branches-regexp}'
 
 - job-group:
-    name: 'verify-exampleservice-jobs'
+    name: 'verify-exampleservice-common'
     jobs:
       - 'verify-licensed'
       - 'tag-collision-reject':
           dependency-jobs: 'verify_exampleservice_licensed'
       - 'verify-sonarqube':
           dependency-jobs: 'verify_exampleservice_tag-collision'
+
+- job-group:
+    name: 'verify-exampleservice-jobs-modern'
+    jobs:
+      - 'helm-api-test':
+          dependency-jobs: 'verify_exampleservice_sonarqube'
+
+- job-group:
+    name: 'verify-exampleservice-jobs-legacy'
+    jobs:
       - 'api-test':
           dependency-jobs: 'verify_exampleservice_sonarqube'
           pipeline_script: 'all-xos-api-test.groovy'
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
index cfee70e..b933ec4 100644
--- a/packer/provision/basebuild.sh
+++ b/packer/provision/basebuild.sh
@@ -165,10 +165,19 @@
     rm -f minikube.deb
     popd
 
-    # give sudo permissions on minikube to jenkins user, so `minikube init` can be run
-    cat <<EOF >/etc/sudoers.d/88-jenkins-minikube
+    # install protobufs
+    PROTOC_VERSION="3.3.0"
+    PROTOC_SHA256SUM="feb112bbc11ea4e2f7ef89a359b5e1c04428ba6cfa5ee628c410eccbfe0b64c3"
+    curl -L -o /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
+    echo "$PROTOC_SHA256SUM  /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip" | sha256sum -c -
+    unzip /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip -d protoc3
+    mv /tmp/protoc3/bin/* /usr/local/bin/
+    mv /tmp/protoc3/include/* /usr/local/include/
+    # give sudo permissions on minikube and protoc to jenkins user
+    cat <<EOF >/etc/sudoers.d/88-jenkins-minikube-protoc
+Cmnd_Alias CMDS = /usr/local/bin/protoc, /usr/bin/minikube
 Defaults:jenkins !requiretty
-jenkins ALL=(ALL) NOPASSWD:SETENV: /usr/bin/minikube
+jenkins ALL=(ALL) NOPASSWD:SETENV: CMDS
 EOF
 
     # clean up