Can environment directive be used in post?

36 views
Skip to first unread message

Idan Adar

unread,
Jun 14, 2017, 8:43:43 AM6/14/17
to Jenkins Users
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?

Kevin Burnett

unread,
Jun 14, 2017, 2:54:06 PM6/14/17
to Jenkins Users
i don't believe you can use the environment instruction in post, no.

Idan Adar

unread,
Jun 15, 2017, 8:17:57 AM6/15/17
to Jenkins Users
Thanks. I ended doing what I needed doing as part of the last stage instead of in post.

Andrew Bayer

unread,
Jun 15, 2017, 8:33:37 AM6/15/17
to jenkins...@googlegroups.com
Fwiw, in this case, you'd want to use withCredentials rather than withEnv. 

A. 

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/30806026-862d-4b3d-8a07-e2d34595b14d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages