Re: Pipeline Input Step

2019-08-02 Thread Lukas Resch

Using

stages {
stage('input') {
input {
message 'Apply changes'
submitterParameter 'COMMITTER'
}//, parameters: [string(defaultValue: 'herp', description: 
'', name: 'derp')]

steps {
echo "${env.COMMITTER}"
}
}
}

I at least get the variable set within my stage, but still not in post. 
In my production file I would like to send out an email to request the 
approval from the team, so moving the input out of the stage is not 
really nice, as the mail would have to be sent from a different stage.


Regards,
Lukas

--
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/6123561c-53ac-afae-6e59-c3b21114f1b2%40ngworx.ag.


Pipeline Input Step

2019-08-02 Thread Lukas Resch

Hi,

I am trying to use the input step and send the name of the person 
accepting the change to an email address. Unfortunately the name in the 
variable is always "null". The name and link in the console output is 
working fine.


There are 2 issues in Jira that are both marked as resolved [0], [1]. 
Also setting an parameter did not change the behaviour for me. I also 
tried a different docker image or setting a submitter for the input step.


While I would understand that there is a scope problem if the name in 
the post stage would be null it is also null when I echo it in the same 
stage.


Is anyone using this successfully and can tell me where I am wrong or 
confirm that the behaviour is not as intended?


Versions:
Jenkins 2.187
    Pipeline: Input Step 2.10

Minimal pipeline for reproduction:

pipeline {
agent {
docker {
image 'alpine'
}
}

stages {
stage('input') {
steps {
input message: 'Apply changes', submitterParameter: 
'COMMITTER'//, parameters: [string(defaultValue: 'herp', description: 
'', name: 'derp')]

echo "${env.COMMITTER}"
}
}
}
post {
success {
emailext body: "Changes were applied by ${env.COMMITTER}", 
subject: 'Changes', to: 't...@example.com'

}
}
}

Regards,
Lukas

[0] https://issues.jenkins-ci.org/browse/JENKINS-40594
[1] https://issues.jenkins-ci.org/browse/JENKINS-41421

--
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/9f823518-ee21-c358-6c2f-e7f17a997f81%40ngworx.ag.


Re: Jenkins Pipeline: input step filled via remote script/curl

2016-08-23 Thread Miłosz Tyborowski
Hello.

I managed to resolve this issue.

Hoping that someone else will benefit from my answer, let me explain how I 
achieved OPs target.

All that Jenkis Pipeline input step needs is a properly formatted JSON and 
OK button caption sent to the right URL. 

So, the proper syntax is:

curl -X POST -H "Jenkins-Crumb:${JENKINS_CRUMB}" -d json='{"parameter": 
{"name": "${PARAMETER_NAME}", "value": "${PARAMETER_VALUE}"}}' -d proceed=
'${SUBMIT_CAPTION}' 
'http://j${JENKINS_URL}/job/${JOB_NAME}/${BUILD_ID}/input/${INPUT_ID}/submit'

Best regards,
Miłosz Tyborowski

W dniu czwartek, 18 sierpnia 2016 14:44:42 UTC+2 użytkownik Miłosz 
Tyborowski napisał:
>
> Hello everyone.
>
> Recently I have been testing Jenkins Pipeline. So far it seems like a 
> wonderful idea, however as beautiful as it looks I run into a problem, a 
> deal-breaker for me as it turns out. 
>
> I have Jenkins pipeline with an Input step, and I would like to submit 
> this input(single string argument) via a script. 
>
> So far I am trying with curl, ideally I'll be sending it via Python 
> requests library. This should be an easy POST request, however with CSRF it 
> becomes tricky. I've obtained Jenkins-Crumb (using curl in this case, from 
> the same machine and same bash session), but still can't send the content...
>
> I'm sending 
> Jenkins-Crumb:XXX header
>
> just like it is explained at 
> https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
>
> my request looks like this:
>
> curl -vvv -X POST -H "Jenkins-Crumb:${JENKINS_CRUMB}" -d 
> 'json="{"parameter":{"name":"${PARAM_NAME}","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}"'
>  
> 'http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/' 
>
>
>
> I have also tried using 
> --form json=
> '{"parameter":{"name":"result_payload","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}'
>
>
> None of which succeeded.
>
> The URL I'm POSTing at is the same, as the one linked in build log 
> (Console output):
> http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/
>
>
> What am I missing to successfully fill in the "Input" step of Jenkins 
> Pipeline?
>
> Any help will be highly appreciated!
>
> Best regards,
> Miłosz Tyborowski.
>

-- 
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/cf1493b2-d111-42fb-a85d-adfd85dae41f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins Pipeline: input step filled via remote script/curl

2016-08-18 Thread Miłosz Tyborowski
Hello everyone.

Recently I have been testing Jenkins Pipeline. So far it seems like a 
wonderful idea, however as beautiful as it looks I run into a problem, a 
deal-breaker for me as it turns out. 

I have Jenkins pipeline with an Input step, and I would like to submit this 
input(single string argument) via a script. 

So far I am trying with curl, ideally I'll be sending it via Python 
requests library. This should be an easy POST request, however with CSRF it 
becomes tricky. I've obtained Jenkins-Crumb (using curl in this case, from 
the same machine and same bash session), but still can't send the content...

I'm sending 
Jenkins-Crumb:XXX header

just like it is explained at 
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

my request looks like this:

curl -vvv -X POST -H "Jenkins-Crumb:${JENKINS_CRUMB}" -d 
'json="{"parameter":{"name":"${PARAM_NAME}","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}"'
 
'http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/' 



I have also tried using 
--form json=
'{"parameter":{"name":"result_payload","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}'


None of which succeeded.

The URL I'm POSTing at is the same, as the one linked in build log (Console 
output):
http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/


What am I missing to successfully fill in the "Input" step of Jenkins 
Pipeline?

Any help will be highly appreciated!

Best regards,
Miłosz Tyborowski.

-- 
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/6bee8bd4-6321-495a-a6b1-78eecb92c3ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins Pipeline: input step filled via remote script/curl

2016-08-18 Thread Miłosz Tyborowski
Hello everyone.

Recently I have been testing Jenkins Pipeline. So far it seems like a 
wonderful idea, however as beautiful as it looks I run into a problem, a 
deal-breaker for me as it turns out. 

I have Jenkins pipeline with an Input step, and I would like to submit this 
input(single string argument) via a script. 

So far I am trying with curl, ideally I'll be sending it via Python 
requests library. This should be an easy POST request, however with CSRF it 
becomes tricky. I've obtained Jenkins-Crumb (using curl in this case, from 
the same machine and same bash session), but still can't send the content...

I'm sending
  
Jenkins-Crumb:XXX header

just like it is explained at 
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

my request looks like this:

curl -vvv -X POST -H "Jenkins-Crumb:${JENKINS_CRUMB}" -d 
'json="{"parameter":{"name":"${PARAM_NAME}","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}"}"'
 
'http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/' 



I have also tried using  
--form json=
'{"parameter":{"name":"result_payload","value":"asd"},"Jenkins-Crumb":"${JENKINS_CRUMB}
"}'



None of which succeeded.


The URL I'm POSTing at is the same, as the one linked in build log (Console 
output):

http://${JENKINS_URL}/job/${JOB_NAME}/${BUILD_NR}/input/


-- 
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/f456bc09-1b41-43c9-a32d-3e4e5edd1091%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2.0 Pipeline - input step with choice param fails

2016-05-04 Thread Lionel Orellana
Cool. Gracias.

On 4 May 2016 at 18:43, Antonio Muñiz  wrote:

>
> On Sun, May 1, 2016 at 4:21 PM, Lionel Orellana 
> wrote:
>
>> Any ideas?
>
>
> Filed https://issues.jenkins-ci.org/browse/JENKINS-34590 (there is a
> workaround in a comment).
>
>
> --
> Antonio Muñiz
> Software Engineer
> CloudBees, Inc.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/IM9HmP3PMf8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAJc7kzSUM4mnnyK1jauz6kaVzUY1CW21LktxTobJxcEh%3D3i8LA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAO-n44PmUUtSZohTNTuWS24ei420f2_FDe1FsJHveMz6JNZKyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2.0 Pipeline - input step with choice param fails

2016-05-04 Thread Antonio Muñiz
On Sun, May 1, 2016 at 4:21 PM, Lionel Orellana  wrote:

> Any ideas?


Filed https://issues.jenkins-ci.org/browse/JENKINS-34590 (there is a
workaround in a comment).


-- 
Antonio Muñiz
Software Engineer
CloudBees, Inc.

-- 
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/CAJc7kzSUM4mnnyK1jauz6kaVzUY1CW21LktxTobJxcEh%3D3i8LA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


2.0 Pipeline - input step with choice param fails

2016-05-01 Thread Lionel Orellana
Hello

I got this code from the snippet generator to capture user input with a 
Choice Parameter:

input message: 'where do you want to build this?', parameters: [[$class: 
'ChoiceParameterDefinition', choices: ['ec2', 'docker'], description: '', 
name: 'label']]

When I add it to my pipeline it throws

java.lang.ClassCastException: hudson.model.ChoiceParameterDefinition.choices 
expects class java.lang.String but received class java.util.ArrayList


ChoiceParameterDefinition 
 
does seem to have a constructor that takes a string[] for choices. 

Any ideas?

thanks

Lionel.

-- 
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/6ee54f06-ca8b-45ef-b079-8cef1c8ea713%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access control in pipeline input step

2016-04-28 Thread Lionel Orellana
Great. Thanks.

On 28 April 2016 at 17:45, Daniel Beck  wrote:

>
> > On 28.04.2016, at 04:23, Lionel Orellana  wrote:
> >
> > How can I restrict who can actually approve a manual (i.e. input) step
> in a pipeline? If I have a "Deploy to PROD" step I only want people with a
> particular role to be able to approve. Am I going about it the wrong way?
> >
>
> 'input' accepts an optional parameter 'submitter' that is the group or
> user allowed to respond to the input request. If your role maps to a group
> in Jenkins, that's what you should be able to specify there.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/0iWKe6hQ-ek/unsubscribe.
> To unsubscribe from this group and all its topics, 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/E54FB9C5-A5DC-4927-BFDC-7194636B7B71%40beckweb.net
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAO-n44OYkvnNawR5zJmB00NbxyUwT9vbHjMF43WX%2Bbcm5trmtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access control in pipeline input step

2016-04-28 Thread Daniel Beck

> On 28.04.2016, at 04:23, Lionel Orellana  wrote:
> 
> How can I restrict who can actually approve a manual (i.e. input) step in a 
> pipeline? If I have a "Deploy to PROD" step I only want people with a 
> particular role to be able to approve. Am I going about it the wrong way?
> 

'input' accepts an optional parameter 'submitter' that is the group or user 
allowed to respond to the input request. If your role maps to a group in 
Jenkins, that's what you should be able to specify there.


-- 
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/E54FB9C5-A5DC-4927-BFDC-7194636B7B71%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Access control in pipeline input step

2016-04-27 Thread Lionel Orellana
Hi

How can I restrict who can actually approve a manual (i.e. input) step in a 
pipeline? If I have a "Deploy to PROD" step I only want people with a 
particular role to be able to approve. Am I going about it the wrong way?

Thanks

Lionel. 

-- 
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/e67e22f7-6c03-4821-b50b-2a21a3079ac5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.