The triggerRemoteJob pipeline step returns a Handle 
<https://github.com/jenkinsci/parameterized-remote-trigger-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/pipeline/Handle.java>,
 
while the build pipeline step returns a RunWrapper 
<https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java>
 when 
wait is enabled (default behavior).

On Monday, 14 September 2020 09:50:33 UTC-7, Marat Gareev wrote:
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fc8ecbc7-e06d-4255-9a31-7aa3923da59co%40googlegroups.com.

Reply via email to