there is a withEnv() wrapper, see 
https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#managing-the-environment.
 
In order to use it in Pipeline with a similar code, you will likely need to 
allow several binary API calls in script security. Not sur eif it's 
convenient

BR, Oleg

вторник, 27 декабря 2016 г., 13:45:56 UTC+1 пользователь Andreas Wuz 
написал:
>
> Hi @ all,
>
> I have a pipeline job in jenkins 2.36, which can be triggered by a remote 
> http-call. Now I have to inject the ip-address of the calling client. In a 
> normal job I did this with the EnvInject-Plugin with following script:
> import hudson.model.*
> import static hudson.model.Cause.RemoteCause
>
>
> def ipaddress=""
> for (CauseAction action : currentBuild.getActions(CauseAction.class)) {
>
>     for (Cause cause : action.getCauses()) {
>         if(cause instanceof RemoteCause){
>              ipaddress=cause.addr
>              break;
>         }
>     }
> }
> return ["ip":ipaddress]
>
> But how can I achieve this with the pipeline-plugin? I cannot use the 
> EnvInject-Plugin in this :-(
>

-- 
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/ab996e83-e4be-4185-99ed-a017be512662%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to