[SDFAB-868] Create new job for running nightly BESS-UPF linerate tests
* Implements a new template containing parameters for the job
* Implements a new pipeline defining job behavior and steps
* Fix virtualenv invocation - zdw
Change-Id: I54189595af50fcdac5206bc00df38080b39a2d95
diff --git a/Makefile b/Makefile
index 0f8597c..93a30a5 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
$(VENV_DIR):
@echo "Setting up virtualenv for JJB testing"
- virtualenv $@
+ python3 -m venv $@
$@/bin/pip install jenkins-job-builder==$(JJB_VERSION) pipdeptree
$(JOBCONFIG_DIR):
diff --git a/jjb/pipeline/bess-upf-linerate.groovy b/jjb/pipeline/bess-upf-linerate.groovy
new file mode 100644
index 0000000..9432f74
--- /dev/null
+++ b/jjb/pipeline/bess-upf-linerate.groovy
@@ -0,0 +1,62 @@
+pipeline {
+ agent none
+ options {
+ timeout(time: 60, unit: 'MINUTES')
+ }
+
+ stages {
+ // start bess-upf on a host server
+ stage('Start BESS-UPF') {
+ agent {
+ label "${params.UPF_HOST_NODE}"
+ }
+ steps {
+ cleanWs()
+
+ // clone upf-epc repo
+ git branch: "${params.GIT_BRANCH}", credentialsId: 'github-onf-bot-ssh-key', url: "${params.GIT_URL}"
+
+ // overwrite config files with personalized config
+ sh 'cp ptf/config/docker_setup.sh .'
+ sh 'cp ptf/config/upf.json conf/'
+
+ // build and start bess-upf
+ sh './docker_setup.sh'
+ }
+ }
+ // run tests from a different server
+ stage('Run linerate tests') {
+ agent {
+ label "${params.BUILD_NODE}"
+ }
+ steps {
+ cleanWs()
+
+ // clone upf-epc
+ git branch: "${params.GIT_BRANCH}", credentialsId: 'github-onf-bot-ssh-key', url: "${params.GIT_URL}"
+
+ // generate python proto files and run tests
+ sh 'cd ptf && bash jenkins.sh'
+ }
+ }
+ }
+ post {
+ always {
+ // stop the upf on the host server
+ node("${params.UPF_HOST_NODE}") {
+ sh 'sleep 5'
+ sh 'docker container kill pause bess bess-web bess-pfcpiface bess-routectl || true'
+ }
+
+ // archive artifacts from the other server's test runs
+ node("${params.BUILD_NODE}") {
+ archiveArtifacts artifacts: 'ptf/log/ptf-logs/*', fingerprint: true
+ }
+ }
+ failure {
+ node("${params.BUILD_NODE}") {
+ step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${params.MAINTAINERS}", sendToIndividuals: false])
+ }
+ }
+ }
+}
diff --git a/jjb/templates/bess-upf-job.yaml b/jjb/templates/bess-upf-job.yaml
new file mode 100644
index 0000000..2ff4575
--- /dev/null
+++ b/jjb/templates/bess-upf-job.yaml
@@ -0,0 +1,58 @@
+---
+# Run all bess-upf linerate test cases
+- job-template:
+ id: 'bess-upf-linerate-tests'
+ name: 'bess-upf-linerate-tests'
+
+ description: |
+ Created by {id} job-template from ci-management/jjb/bess-upf-job.yaml, script ../pipeline/bess-upf.groovy<br/>
+
+ # Cron syntax; trigger daily at 23:00 PST
+ triggers:
+ - timed: |
+ TZ=US/Pacific
+ 0 23 * * *
+
+ properties:
+ - onf-infra-properties:
+ build-days-to-keep: '14'
+ artifact-num-to-keep: '14'
+
+ wrappers:
+ - lf-infra-wrappers:
+ jenkins-ssh-credential: '{github-onf-bot-ssh-credential}'
+ build-timeout: '{build-timeout}' # NOTE - required for JJB macro, not used, see groovy file
+
+ parameters:
+ - string:
+ name: BUILD_NODE
+ default: 'menlo-pdp-lotta-nics'
+ description: 'Name of the Jenkins build executor to run the job on'
+ - string:
+ name: UPF_HOST_NODE
+ default: 'BESS-Test'
+ description: 'Name of the remote server hosting the BESS-UPF instance'
+ - string:
+ name: GIT_URL
+ default: 'git@github.com:dariusgrassi/upf-epc.git'
+ description: 'Location of bess-upf repository that tests will check'
+ - string:
+ name: GIT_BRANCH
+ default: 'master'
+ description: 'Name of Git branch to pull from bess-upf repository'
+ - string:
+ name: MAINTAINERS
+ default: 'max@opennetworking.org, carmelo@opennetworking.org'
+ description: 'Contacts of people to bother when BESS-UPF line rate tests fail'
+
+ project-type: pipeline
+ concurrent: true
+ extraEnvironmentVars: ""
+ sandbox: true
+
+ dsl: !include-raw-escape: ../pipeline/bess-upf-linerate.groovy
+
+- project:
+ name: bess-upf-linerate-tests
+ jobs:
+ - 'bess-upf-linerate-tests'