node {
try
{
stage('Checkout') {
cleanWs()
checkout scm
}
stage('Restore') {
sh "dotnet restore $proj"
}
stage('Build') {
sh "dotnet restore $proj"
}
stage ('Unit test') {
sh "dotnet test $test"
}
}
} catch (err) {
emailext body: ' ${JOB_NAME} ${BUILD_NUMBER} is failing! Somebody should do something about that. https://jenkins-ma.com/job/Test/${BUILD_NUMBER}/console', subject: 'FAILURE', to: 'someEmail..' }
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2c7db49d-68ef-4c41-8cd2-39ff6855ad83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/DM6PR15MB3452B3FF105E05324B50A9C4AC760%40DM6PR15MB3452.namprd15.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Best Regards / Mit freundlichen Grüßen,
Faad Sayaou,
Embedded Systems for Mechatronics Masters student | FH Dortmund | Germany
Fachhochschule Dortmund
University of Applied Sciences and Arts
Email: faad...@gmail.com
I am currently experiencing a strange effect when using the MStest plugin. My test report is only generated when the test is successful but when it fails, no test report is generated.
node {
stage('Checkout') {
cleanWs()
checkout scm
return
skipRemainingStages = true
}
stage('Restore') {
sh "dotnet restore $proj"
}
stage('Build') {
sh "dotnet publish $proj --output $outputFolder --configuration Release -p:Version=$buildVersion -p:FileVersion=$buildVersion"
}
stage ('Unit test') {
sh "dotnet restore $UnitTest"
sh returnStdout: true, script: "dotnet test $UnitTest --logger \'trx;LogFileName=unit_tests.xml\'
|| true"
step ([$class: 'MSTestPublisher', testResultsFile:"**/*.xml", failOnError: true, keepLongStdio: true])
}
stage ('publish') { }
}
node(...) {
try {
...add stages here...
} catch(Exception e) {
currentBuild.result = 'FAILURE' // Let the post step know that the build failed with an error.
throw e
} finally {
builder.post(currentBuild)
}
} // node
def post(def currentBuild) {
String currentResult = currentBuild.result ?: 'SUCCESS'
echo "post ${currentResult}"
try {
postAlways(currentBuild)
} catch(Exception e) {
def converted = toString(e)
echo "postAlways failed (ignored):\n${converted}"
}
if (currentResult == 'SUCCESS') {
success(currentBuild)
} else {
failed(currentBuild, currentResult)
}
}