'groovy.lang.MissingPropertyException: No such property: build for class
I am a beginner in jenkins and i need some help. I have the follow code
but when i build my job the result is an error: groovy.lang.MissingPropertyException: No such property: build for class
i need to return the result of my job to a pipeline. How can i do this? thanks in advance
import hudson.model.*
def buildNumber = build.properties.environment.BUILD_NUMBER
println buildNumber
File file = new File("./SRC");
if(file.exists()){
if (file.isDirectory()) {
currentBuild.result = 'SUCCESS'
return
}
}
Solution 1:[1]
You can use the currentBuild property to get more information about the build:
def buildNumber = currentBuild.number
println buildNumber
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Charlse Wu |
