Fwiw, in this case, you'd want to use withCredentials rather than withEnv.

A.

On Jun 15, 2017 8:18 AM, "Idan Adar" <[email protected]> wrote:

> Thanks. I ended doing what I needed doing as part of the last stage
> instead of in post.
>
> On Wednesday, June 14, 2017 at 9:54:06 PM UTC+3, Kevin Burnett wrote:
>>
>> i don't believe you can use the environment instruction in post, no.
>>
>> but you can use withEnv: https://jenkins.io/do
>> c/pipeline/steps/workflow-basic-steps/#code-withenv-code-
>> set-environment-variables
>>
>> On Wednesday, June 14, 2017 at 8:43:43 AM UTC-4, Idan Adar wrote:
>>>
>>> In a stage I can do the following:
>>>
>>> stage ("Merge pull request") {
>>>          environment {
>>>             JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
>>>          }
>>>          ...
>>>          ...
>>>          steps {
>>>
>>>          }
>>> }
>>>
>>> Can this done also in post?
>>>
>>> post {
>>>      success {
>>>          environment {
>>>              JENKINSBOT = credentials('${JENKINSBOT_GHE_ACCESS_TOKEN}')
>>>      }
>>>
>>>      script {
>>>
>>>      }
>>>   }
>>> }
>>>
>>>
>>> Or is there any other way to ahchieve 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/30806026-862d-4b3d-8a07-e2d34595b14d%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/30806026-862d-4b3d-8a07-e2d34595b14d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdOaGVgU-e1Beyub8b5DAdsyT5OasDbAvpEcHSkQB58%2BVtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to