Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
a workaround for JENKINS-43995
// Jenkins Groovy pipeline code
// Runs rspec files
def RunSpec(specName) {
def rspeccommand = "rspec spec/" + specName + ".rb --colour --tty --format html --out " + specName + "_results.html --format documentation"
try {
sh rspeccommand
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '.', reportFiles: specName + "_results.html", reportName: specName, reportTitles: specName])
} catch(err) {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '.', reportFiles: specName + "_results.html", reportName: specName, reportTitles: specName])
error 'FAIL' //sh "exit 1" // this fails the stage
}
} //end def RunSpec
node{
stage('git checkouts') {
checkout(...whatever you need here to checkout code...)
} //end stage('git checkouts')
try {
stage('Run Spec1') {
RunSpec('spec1')
}
} catch(err) {echo "Problem running Spec1 Tests"}
try {
stage('Run Spec2') {
RunSpec('spec3')
}
} catch(err) {echo "Problem running Spec2 Tests"}
try {
stage('Run Spec3') {
RunSpec('spec3')
}
} catch(err) {echo "Problem running Spec3 Tests"}
try {
stage('Run Spec4') {
RunSpec('spec4')
}
} catch(err) {echo "Problem running Spec4 Tests"}
} //node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.