Reputation: 1747
Is there a way to fetch URL of a build step (without waiting for completion) through Jenkins pipeline script?
Here is what I've tried but the return value of build is null
.
def build_job = build job: 'dummy_job', wait: false
Trying to fetch URL as follows:
build_job.absoluteUrl
Upvotes: 8
Views: 5639
Reputation: 6458
You can get it by using the getRawBuild() method:
def build_job=build(job:'dummy_job',propagate:false)
echo build_job.getResult()
echo build_job.getRawBuild().getAbsoluteUrl()
Don't use wait: false
since the function won't return the expected result.
propagate: false
is so that the current job won't abort (fail before the next step) if the called job fails.
Upvotes: 5