Created
April 24, 2018 15:31
-
-
Save yin042018/f7a65e9e9b93c828377ab939c5fbd6b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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