Hello,

I'm trying to use enum for processing the result of the *build* step.

Working example of using *triggerRemoteJob*:

> def jobBuild = triggerRemoteJob remoteJenkinsName: remoteJenkins, job:
> jobName,
>                     shouldNotFailBuild: true
> if (jobBuild.getBuildResult() != Result.SUCCESS) {
>     currentBuild.result = Result.UNSTABLE.toString()
> }


But the same solution for *build* doesn't work (always falls to if
statement)

> import hudson.model.Result

...

Map job = [:]
> String jobName = "My-Local-Job"
> job["job"] = jobName
> job["parameters"] = [
>     [$class: 'StringParameterValue', name: 'GIT_BRANCH', value: BRANCH]]
> job["wait"] = true
> def jobBuild = build job
>
> if (jobBuild.getResult() != Result.SUCCESS) {
>     currentBuild.result = Result.FAILURE.toString()
>     error "Build was failed"
> }


 So, I have to work with strings

> String jobResult = jobBuild.getResult()
> if (jobResult != "SUCCESS") {
>     currentBuild.result = 'FAILURE'
>     error "Build was failed"
> }


How can I use enum with the *build* step?

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAGBFc1WPfwoRz7873PehzmxC7NF0B9ue%3D%3Dh9oh3YeF2Uz6WntQ%40mail.gmail.com.

Reply via email to