Continuous Integration

cancel
Showing results for 
Search instead for 
Did you mean: 

Jenkins Build Result feedback

Solved!
Go to solution

Hi,

I have setup a Jenkins with GITlab Continues Integration setup Based on the NI Knowledge Article:
LabVIEW Continuous Integration With Jenkins/GitHub - National Instruments (ni.com)
The Project itself is working correctly.
If I edit a VI in a way that it is broken. I get the error description in the „Consele Output“ but in the „Stage View“ I didn’t see that the build is failed.
lvPipeline.groovy:
stage('Build project') {
try {
timeout(time: 60, unit: 'MINUTES') {
lvBuild(lvProjectPath, "My Computer", lvBuildSpecName, lvVersion, lvBitness)
}
} catch (err) {
stageResult= 'NOT_BUILT'
currentBuild.result = 'NOT_BUILT'
echo "Project Build Failed: ${err}"
}
}

 

I try different variants without any result. My guess catch(err) never give a result.
Perhaps somebody has a solution for this Problem.

 

Thank You

0 Kudos
Message 1 of 2
(1,937 Views)
Solution
Accepted by topic author bodo_online

#!/usr/bin/env groovy
import java.*
import java.lang.*
import hudson.*
import hudson.model.*
import jenkins.model.Jenkins

 

 

 

 

stage('\u277A CheckLog Build') {
if (manager.logContains('.*ExecuteBuildSpec operation succeeded.*')) {
stageResult= 'SUCCESS'
currentBuild.result = 'SUCCESS'
echo "\u2705 Project Build PASS"
}else{
echo "\u274C Project Build Failed:"
error("Build failed because of this and that...")
stageResult= 'NOT_BUILT'
currentBuild.result = 'NOT_BUILT'
return PipelineResult.ABORTED
}

}

0 Kudos
Message 2 of 2
(1,895 Views)