[VOL-3358] Initial template for voltha-scale-matrix job
Change-Id: If3eb064b4d8eef5bb1cf6ba7d815a8b8a6f9d34b
diff --git a/jjb/pipeline/voltha-scale-matrix.groovy b/jjb/pipeline/voltha-scale-matrix.groovy
new file mode 100644
index 0000000..5aa4b3e
--- /dev/null
+++ b/jjb/pipeline/voltha-scale-matrix.groovy
@@ -0,0 +1,122 @@
+// Copyright 2019-present Open Networking Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+pipeline {
+
+ agent {
+ label "${params.buildNode}"
+ }
+ options {
+ timeout(time: 30, unit: 'MINUTES')
+ }
+ environment {
+
+ }
+
+ stages {
+ stage ('Cleanup') {
+ steps {
+ timeout(time: 11, unit: 'MINUTES') {
+ sh returnStdout: false, script: """
+ helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
+ helm repo add stable https://kubernetes-charts.storage.googleapis.com
+ helm repo add onf https://charts.opencord.org
+ helm repo add cord https://charts.opencord.org
+ helm repo add onos https://charts.onosproject.org
+ helm repo add atomix https://charts.atomix.io
+ helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts
+ helm repo update
+
+ # removing ETCD port forward
+ P_ID="\$(ps e -ww -A | grep "_TAG=etcd-port-forward" | grep -v grep | awk '{print \$1}')"
+ if [ -n "\$P_ID" ]; then
+ kill -9 \$P_ID
+ fi
+
+ for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat');
+ do
+ echo "Purging chart: \${hchart}"
+ helm delete "\${hchart}"
+ done
+ bash /home/cord/voltha-scale/wait_for_pods.sh
+
+ test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
+
+ cd $WORKSPACE
+ rm -rf $WORKSPACE/*
+ """
+ }
+ }
+ }
+ stage('Clone kind-voltha') {
+ steps {
+ checkout([
+ $class: 'GitSCM',
+ userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
+ branches: [[ name: "master", ]],
+ extensions: [
+ [$class: 'WipeWorkspace'],
+ [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
+ [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+ ],
+ ])
+ script {
+ sh(script:"""
+ if [ '${kindVolthaChange}' != '' ] ; then
+ cd $WORKSPACE/kind-voltha;
+ git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD
+ fi
+ """)
+ }
+ }
+ }
+ stage('Clone voltha-system-tests') {
+ steps {
+ checkout([
+ $class: 'GitSCM',
+ userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
+ branches: [[ name: "${release}", ]],
+ extensions: [
+ [$class: 'WipeWorkspace'],
+ [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
+ [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+ ],
+ ])
+ script {
+ sh(script:"""
+ if [ '${volthaSystemTestsChange}' != '' ] ; then
+ cd $WORKSPACE/voltha-system-tests;
+ git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
+ fi
+ """)
+ }
+ }
+ }
+ stage('Deploy and test') {
+ repeat_deploy_and_test(topologies)
+ }
+ }
+}
+
+topologies = [
+ {'onu': 1, 'pon': 1},
+ {'onu': 2, 'pon': 1},
+ {'onu': 2, 'pon': 2},
+]
+
+def repeat_deploy_and_test(list) {
+ for (int i = 0; i < list.size(); i++) {
+ sh "echo Setting up with ${list[i]['pon']}x${list[i]['onu']}"
+ }
+}
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index b6ce923..6f72350 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -572,3 +572,44 @@
concurrent: false
dsl: !include-raw-escape: pipeline/{pipeline-script}
+
+- job-template:
+ id: 'voltha-scale-matrix-dev'
+ name: '{name}'
+ pipeline-script: 'voltha-scale-matrix.groovy'
+
+ description: |
+ <!-- Managed by Jenkins Job Builder -->
+ Created by {id} job-template from ci-management/jjb/voltha-scale.yaml <br /><br />
+ Using pipeline {pipeline-script} <br/><br/>
+ Scale measurements for VOLTHA 2.x
+
+ properties:
+ - cord-infra-properties:
+ build-days-to-keep: '{build-days-to-keep}'
+ artifact-num-to-keep: '{artifact-num-to-keep}'
+
+ wrappers:
+ - lf-infra-wrappers:
+ build-timeout: '{build-timeout}'
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+ # default values
+ release: master
+ build-node: 'voltha-scale'
+
+ project-type: pipeline
+ concurrent: false
+
+ dsl: !include-raw-escape: pipeline/{pipeline-script}
+
+ parameters:
+ - string:
+ name: release
+ default: '{release}'
+ description: 'Version of the code to test (matches a branch in kind-voltha and voltha-system-tests repos)'
+
+ - string:
+ name: buildNode
+ default: '{build-node}'
+ description: 'Name of the Jenkins node to run the job on'