How to get folder name of job if know only CHANGE_TARGET?

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

How to get folder name of job if know only CHANGE_TARGET?

Slava Dubrovskiy
Hi.

I use multibranch pipeline job. In pipeline for PR I see
env.CHANGE_TARGET variable. For example: CHANGE_TARGET=maintenance/2.4

But in folder branches of job, it transformed in maintenance-2-4.c4g2o8

Ho can I get name of folder if know only env.CHANGE_TARGET? What
function used for encode maintenance/2.4 -> maintenance-2-4.c4g2o8 ?

I need it because PR use some artifacts from CHANGE_TARGET branch.

Thank you.

--
WBD,
Viacheslav Dubrovskyi


--
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/ebfe6b1e-1ac0-034a-0a58-07afe4d7f754%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to get folder name of job if know only CHANGE_TARGET?

Slava Dubrovskiy
Found the answer:

import jenkins.branch.NameMangler
NameMangler.apply('maintenance/2.4')

Result: maintenance-2-4.c4g2o8



28.12.2017 15:59, Viacheslav Dubrovskyi пишет:

> Hi.
>
> I use multibranch pipeline job. In pipeline for PR I see
> env.CHANGE_TARGET variable. For example: CHANGE_TARGET=maintenance/2.4
>
> But in folder branches of job, it transformed in maintenance-2-4.c4g2o8
>
> Ho can I get name of folder if know only env.CHANGE_TARGET? What
> function used for encode maintenance/2.4 -> maintenance-2-4.c4g2o8 ?
>
> I need it because PR use some artifacts from CHANGE_TARGET branch.
>
> Thank you.
>
--
WBD,
Viacheslav Dubrovskyi


--
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/41ebe258-509f-0c77-d133-44fec9716366%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

smime.p7s (4K) Download Attachment