78 lines
3.9 KiB
Plaintext
78 lines
3.9 KiB
Plaintext
// Jenkins Pipelines for longhaul
|
|
|
|
pipeline {
|
|
|
|
parameters {
|
|
choice(name: 'node', choices: 'gce-reg\ngce-load', description: 'select env to run tests in ')
|
|
choice(name: 'key', choices: 'master\nPR', description: 'Select master or a PR to run tests aganist - defaults to master')
|
|
string(name: 'PR', defaultValue: '', description: 'PR number, required if key value is set to PR')
|
|
string(name: 'version', defaultValue: '', description: 'Version to run tests against')
|
|
string(name: 'Load_test', defaultValue: 'TestBlockLongHaul', description: 'select a load test to run ')
|
|
string(name: 'load_factor', defaultValue: '20', description: 'load factor - number of concurrent threads running per test')
|
|
string(name: 'load_time', defaultValue: '1800', description: 'load time - number of seconds each thread runs')
|
|
string(name: 'volume_count', defaultValue: '3', description: 'volume count - number of concurrent volumes being create(file/block or object')
|
|
string(name: 'runs', defaultValue: '20', description: 'number of test runs ')
|
|
string(name: 'run_interval', defaultValue: '600', description: 'interval between test runs in seconds')
|
|
}
|
|
|
|
agent { label "${params.node}-master" }
|
|
|
|
options {
|
|
disableConcurrentBuilds()
|
|
timestamps()
|
|
}
|
|
|
|
stages {
|
|
stage('checkout test scripts') {
|
|
steps {
|
|
sh "mkdir -p _output"
|
|
script {
|
|
if ( "${params.key}" == 'PR' ){
|
|
if ( "${params.PR}" == '' ){
|
|
echo '[FAILURE] Need A valid PR number to continue'
|
|
currentBuild.result = 'FAILURE'
|
|
return
|
|
}
|
|
sh "wget -O longhaul https://release.rook.io/build/pr/${params.PR}/${params.version}/tests/linux_amd64/longhaul"
|
|
sh "wget -O _output/go-junit-report https://release.rook.io/build/pr/${params.PR}/${params.version}/go-junit-report"
|
|
|
|
}else {
|
|
sh "wget -O longhaul https://release.rook.io/build/master/${params.version}/tests/linux_amd64/longhaul"
|
|
sh "wget -O _output/go-junit-report https://release.rook.io/build/master/${params.version}/go-junit-report"
|
|
}
|
|
sh "chmod +x _output/go-junit-report"
|
|
}
|
|
}
|
|
}
|
|
stage ("Run Longhaul") {
|
|
steps{
|
|
script {
|
|
for(i=0; i< "${env.runs}".toInteger() ; i++) {
|
|
try{
|
|
sh '''#!/bin/bash
|
|
set -o pipefail
|
|
export KUBECONFIG=$HOME/admin.conf
|
|
kubectl config view
|
|
kubectl get nodes
|
|
chmod +x longhaul
|
|
mkdir -p _output/tests/
|
|
./longhaul -test.v -test.run '''+ "${env.Load_test}" + ''' -test.timeout 3600s --load_parallel_runs '''+"${env.load_factor}"+''' --load_volumes '''+"${env.volume_count}"+''' --load_time '''+"${env.load_time}"+ ''' 2>&1 | tee _output/tests/longHaulTest_'''+"$i"+'''.log
|
|
cat _output/tests/longHaulTest_''' + "$i"+'''.log | _output/go-junit-report > _output/tests/longHaulTest_'''+"$i"+'''.xml'''
|
|
}
|
|
finally{
|
|
archive '_output/tests/longHaulTest_'+"$i"+'.log,_output/tests/longHaulTest_'+"$i"+'.xml'
|
|
junit allowEmptyResults: true, keepLongStdio: true, testResults: '_output/tests/longHaulTest_'+"$i"+'.xml'
|
|
}
|
|
sleep "${env.run_interval}".toInteger()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
deleteDir()
|
|
}
|
|
}
|
|
} |