forked from rook/rook
84 lines
4.1 KiB
Plaintext
84 lines
4.1 KiB
Plaintext
// Jenkins Pipelines for Rook Regression
|
|
|
|
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')
|
|
}
|
|
|
|
agent { label "${params.node}-master" }
|
|
|
|
options {
|
|
disableConcurrentBuilds()
|
|
timestamps()
|
|
}
|
|
|
|
stages {
|
|
stage('checkout test scripts') {
|
|
steps {
|
|
sh "mkdir -p _output/charts/"
|
|
sh "wget -O helm.sh https://raw.githubusercontent.com/rook/rook/master/tests/scripts/helm.sh"
|
|
script {
|
|
if ( "${params.key}" == 'PR' ){
|
|
if ( "${params.PR}" == '' ){
|
|
echo '[FAILURE] Need A valid PR number to continue'
|
|
currentBuild.result = 'FAILURE'
|
|
error 'Exit pipeline need a pr number'
|
|
}
|
|
sh "wget -O integration https://release.rook.io/build/pr/${params.PR}/${params.version}/tests/linux_amd64/integration"
|
|
sh "wget -O _output/go-junit-report https://release.rook.io/build/pr/${params.PR}/${params.version}/go-junit-report"
|
|
sh "wget -O version https://release.rook.io/build/pr/${params.PR}/${params.version}/version"
|
|
versionId = readFile('version').trim()
|
|
sh "wget -O _output/charts/index.yaml https://release.rook.io/build/pr/${params.PR}/${params.version}/charts/index.yaml"
|
|
sh "wget -O _output/charts/rook-${versionId}.tgz https://release.rook.io/build/pr/${params.PR}/${params.version}/charts/rook-${versionId}.tgz"
|
|
|
|
}else {
|
|
sh "wget -O integration https://release.rook.io/build/master/${params.version}/tests/linux_amd64/integration"
|
|
sh "wget -O _output/go-junit-report https://release.rook.io/build/master/${params.version}/go-junit-report"
|
|
sh "wget -O version https://release.rook.io/build/master/${params.version}/version"
|
|
versionId = readFile('version').trim()
|
|
sh "wget -O _output/charts/index.yaml https://release.rook.io/build/master/${params.version}/charts/index.yaml"
|
|
sh "wget -O _output/charts/rook-${versionId}.tgz https://release.rook.io/build/master/${params.version}/charts/rook-${versionId}.tgz"
|
|
}
|
|
sh "chmod +x _output/go-junit-report"
|
|
}
|
|
}
|
|
}
|
|
//Run regression
|
|
stage ("Run Regression") {
|
|
steps{
|
|
script {
|
|
sh '''#!/bin/bash
|
|
export KUBECONFIG=$HOME/admin.conf
|
|
chmod +x helm.sh
|
|
./helm.sh up'''
|
|
try{
|
|
sh '''#!/bin/bash
|
|
set -o pipefail
|
|
export KUBECONFIG=$HOME/admin.conf
|
|
kubectl config view
|
|
kubectl get nodes
|
|
chmod +x integration
|
|
mkdir -p _output/tests/
|
|
./integration -test.v -test.timeout 1800s 2>&1 | tee _output/tests/regressionTests.log'''
|
|
}
|
|
finally{
|
|
sh "cat _output/tests/regressionTests.log | _output/go-junit-report > _output/tests/regressionTests.xml"
|
|
archive '_output/tests/*.log,_output/tests/*.xml'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
junit allowEmptyResults: true, keepLongStdio: true, testResults: '_output/tests/*.xml'
|
|
deleteDir()
|
|
}
|
|
}
|
|
}
|