Jenkins Pipeline - build job step, ability to return build job number

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Kai
Reply | Threaded
Open this post in threaded view
|

Jenkins Pipeline - build job step, ability to return build job number

Kai
Hi,

We are using Jenkins Pipeline - build job step and wanted the ability to return build job number so that we can use the build job # in the next step.

e.g.
buildJobNumber=build job: 'my-test-job', parameters: [string(name: 'environment', value: 'QA')], quietPeriod: 10

Then be able to use buildJobNumber in the next stage.

Thanks


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6447f75c-8853-4295-bfa7-cb92c2e87812%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins Pipeline - build job step, ability to return build job number

Victor Martinez
The build job step returns a RunWrapper object, and in your case you can use the getId method

def buildObj = build job: 'my-test-job', parameters: [string(name: 'environment', value: 'QA')], quietPeriod: 10
echo buildObj.getId()

Cheers

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5d95bfeb-e461-4d33-b04f-93b4e7bc13bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kai
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins Pipeline - build job step, ability to return build job number

Kai
wow, thanks so much!

On Saturday, December 23, 2017 at 3:35:42 AM UTC-8, Victor Martinez wrote:
The build job step returns a RunWrapper object, and in your case you can use the <a href="http://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html#getId--" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjavadoc.jenkins.io%2Fplugin%2Fworkflow-support%2Forg%2Fjenkinsci%2Fplugins%2Fworkflow%2Fsupport%2Fsteps%2Fbuild%2FRunWrapper.html%23getId--\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjEm-bpthyONmpCTUF-IAg72ntEQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fjavadoc.jenkins.io%2Fplugin%2Fworkflow-support%2Forg%2Fjenkinsci%2Fplugins%2Fworkflow%2Fsupport%2Fsteps%2Fbuild%2FRunWrapper.html%23getId--\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjEm-bpthyONmpCTUF-IAg72ntEQ&#39;;return true;">getId method

def buildObj = build job: 'my-test-job', parameters: [string(name: 'environment', value: 'QA')], quietPeriod: 10
echo buildObj.getId()

Cheers

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2e99ca17-77a7-4cfa-96e8-cd7e0487ee02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.