Re: Inject variable in pipeline plugin

2016-12-30 Thread Andreas Wuz
Hi, thanks for your answer :)

But how can I inject this variable? Is it like this:

withEnv(["ip"]) { //Script for getting the ip }

Sorry I'm a newby in Jenkins and Groovy. How can I set the scrpit security 
for allow binary API calls?

Am Dienstag, 27. Dezember 2016 13:45:56 UTC+1 schrieb 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fab7754a-e0d2-4f7f-8ca2-7a084ebf0369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Inject variable in pipeline plugin

2016-12-27 Thread 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8d0cc6fb-da55-4e7d-b44a-73cad29e70ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Decide on return value of job using pipeline plugin

2016-12-20 Thread Andreas Wuz
Hi,

I am building a pipeline in Jenkins 2.36 with the pipeline plugin. I have 
some jobs to execute. 

To call the job I use: build job: 'transformInput', parameters: 
[string(name: 'cert_request', value: ''), string(name: 'cert_signature', 
value: ''), string(name: 'public_cert', value: '')], all works fine

But now I have to check whether the job was successful or not. When it 
ended successful, another job (e.g. JOB2) should be built. When it failed, 
job JOB3 should be built. 

How can I perform this "if" with the pipeline plugin?

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d56aad0c-799c-478d-8c96-e7d6f34984a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Human submit after job

2016-12-14 Thread Andreas Wuz
Hi,

I am developing a little workflow through jenkins jobs. Now I need to 
submit manually after a job has succeeded. So for example: Job  -> manual 
submit -> job 2. I thought this could be accomplished with a button or 
something else. Is this possible, e.g. with a plugin?

Best regards,
Wuz

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8613cc52-47e5-4efc-b3e7-81cd22c83f57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting the remote IP of the client which triggered a build

2016-11-23 Thread Andreas Wuz
Thanks, it works fine!

Am Mittwoch, 23. November 2016 08:13:35 UTC+1 schrieb Ted Xiao:
>
> If you want to access it via shell script, you can install the EnvInject 
> plugin and configure the plugin to Evaluated Groovy 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]
>
> then access the variable $ip in shell script
>
> On Wednesday, November 23, 2016 at 11:58:55 AM UTC+8, Ted Xiao wrote:
>>
>> javadoc for RemoteCause.getAddr()
>> http://javadoc.jenkins.io/hudson/model/Cause.RemoteCause.html#getAddr()
>>
>>
>> On Wednesday, November 23, 2016 at 11:56:27 AM UTC+8, Ted Xiao wrote:
>>>
>>> You call access it by RemoteCause, pseudo code:
>>>
>>>
>>> for (CauseAction action : build.getActions(CauseAction.class)) {
>>> for (Cause cause : action.getCauses()) {
>>> if(cause instanceof RemoteCause){
>>> //blah
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>>
>>> On Tuesday, November 22, 2016 at 8:16:45 PM UTC+8, Andreas Wuz wrote:
>>>>
>>>> Hi @ all,
>>>>
>>>> I am implementing an infrastructure with Jenkins. I hava a 
>>>> parameterized job with a basic shell script. This script can be run 
>>>> remotely, i.e. it could be triggered over an http-request like 
>>>> http://testserver.de:8009/job/receiveCSR/build?token=123. Now I need 
>>>> the IP of the client, which set triggered this build. When I see the 
>>>> console output 
>>>>
>>>> Started by remote host 10.1.1.111
>>>>
>>>> I think, this should be possible, isn't it? If not, is there any plugin 
>>>> which I can use for this?
>>>>
>>>> Thanks for your help!
>>>>
>>>>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fa804fae-f6ce-4e0b-afa5-7d72a79d2031%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting the remote IP of the client which triggered a build

2016-11-22 Thread Andreas Wuz
Hi @ all,

I am implementing an infrastructure with Jenkins. I hava a parameterized 
job with a basic shell script. This script can be run remotely, i.e. it 
could be triggered over an http-request like 
http://testserver.de:8009/job/receiveCSR/build?token=123. Now I need the IP 
of the client, which set triggered this build. When I see the console 
output 

Started by remote host 10.1.1.111

I think, this should be possible, isn't it? If not, is there any plugin which I 
can use for this?

Thanks for your help!

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/82214c37-777a-4918-8968-23b42acc5f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.