mirror of https://github.com/rancher/dashboard.git
88 lines
2.7 KiB
Groovy
88 lines
2.7 KiB
Groovy
#!groovy
|
|
|
|
def branch = "master"
|
|
if ("${env.branch}" != "null" && "${env.branch}" != "") {
|
|
branch = "${env.branch}"
|
|
}
|
|
|
|
if ("${env.CORRAL_PACKAGES_REPO}" != "null" && "${env.CORRAL_PACKAGES_REPO}" != "") {
|
|
corralRepo = "${env.CORRAL_PACKAGES_REPO}"
|
|
}
|
|
|
|
if ("${env.CORRAL_PACKAGES_BRANCH}" != "null" && "${env.CORRAL_PACKAGES_BRANCH}" != "") {
|
|
corralBranch = "${env.CORRAL_PACKAGES_BRANCH}"
|
|
}
|
|
|
|
node {
|
|
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm', 'defaultFg': 2, 'defaultBg':1]) {
|
|
withFolderProperties {
|
|
paramsMap = []
|
|
params.each {
|
|
paramsMap << "$it.key=$it.value"
|
|
}
|
|
withEnv(paramsMap) {
|
|
stage('Checkout') {
|
|
deleteDir()
|
|
checkout([
|
|
$class: 'GitSCM',
|
|
branches: [[name: "*/${branch}"]],
|
|
extensions: scm.extensions + [[$class: 'CleanCheckout']],
|
|
userRemoteConfigs: scm.userRemoteConfigs
|
|
])
|
|
dir('./corral-packages') {
|
|
checkout([
|
|
$class: 'GitSCM',
|
|
branches: [[name: "*/${corralBranch}"]],
|
|
extensions: scm.extensions + [[$class: 'CleanCheckout']],
|
|
userRemoteConfigs: [[url: 'https://github.com/'+corralRepo]]
|
|
])
|
|
sh 'git --no-pager branch'
|
|
def ciFilename = "dashboard-tests.yaml"
|
|
def ciConfigContents = env.CORRAL_PACKAGE_CONFIG
|
|
if (ciConfigContents != null) {
|
|
writeFile file: "./packages/aws/"+ciFilename, text: ciConfigContents
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
stage('Run Tests') {
|
|
sh 'pwd'
|
|
sh 'ls -al cypress/jenkins'
|
|
sh 'cypress/jenkins/init.sh'
|
|
}
|
|
} catch (err) {
|
|
echo "Error: " + err
|
|
currentBuild.result = 'FAILURE'
|
|
error()
|
|
}
|
|
try {
|
|
stage('Grab Results') {
|
|
sh "cypress/jenkins/scpget.sh dashboard/results.xml"
|
|
sh "cypress/jenkins/scpget.sh dashboard/results.html"
|
|
sh "cypress/jenkins/scpget.sh dashboard/assets"
|
|
}
|
|
} catch(err) {
|
|
echo "Error: " + err
|
|
}
|
|
try {
|
|
stage('Clean Test Environment') {
|
|
sh "${WORKSPACE}/bin/corral delete ci"
|
|
if ("${env.JOB_TYPE}" == "recurring") {
|
|
sh "${WORKSPACE}/bin/corral delete rancher"
|
|
}
|
|
}
|
|
} catch(err) {
|
|
echo "Error: " + err
|
|
}
|
|
try {
|
|
stage('Test Report') {
|
|
step([$class: 'JUnitResultArchiver', testResults: '**/results.xml'])
|
|
}
|
|
}
|
|
catch(err) {
|
|
echo "Error: " + err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |