script { } it is... :/

On Thursday, April 6, 2017 at 7:39:27 PM UTC+3, Andrew Bayer wrote:
>
> No, that's definitely not intended to work that way, and it probably won't 
> work. 
>
> On Apr 6, 2017 9:09 AM, "Idan Adar" <[email protected] <javascript:>> wrote:
>
>> Yes, that's how I do it in my actual Jenkinsfile, but I thought maybe in 
>> a Declarative pipeline this works differently...
>>
>> On Thursday, April 6, 2017 at 6:57:13 PM UTC+3, Danny Rehelis wrote:
>>>
>>> Encapsulate MY_VAR in script { } blocked required to set a variable when 
>>> using declarative pipeline inside a Stage. 
>>>
>>> No need to declare it with-in environment { }. 
>>>
>>> On Thu, Apr 6, 2017, 18:42 Idan Adar <[email protected]> wrote:
>>>
>>>> Perhaps Robert (CCed) can help?
>>>>
>>>>
>>>> On Thursday, April 6, 2017 at 6:08:18 PM UTC+3, Idan Adar wrote:
>>>>>
>>>>> Is this a valid use of environment directive and variables in 
>>>>> declarative pipeline?
>>>>>
>>>>> pipeline {
>>>>>    environment {
>>>>>        MY_VAR = null
>>>>>    }  
>>>>>
>>>>>
>>>>>    stages {
>>>>>       stage ("...") {
>>>>>          steps {
>>>>>          MY_VAR = "this_stage"
>>>>>          }
>>>>>       }
>>>>>       stage ("...") {
>>>>>          steps {
>>>>>          MY_VAR = "this_stage2"
>>>>>          }
>>>>>       }
>>>>>   }
>>>>>   
>>>>>   post {
>>>>>       success {
>>>>>           slackSend (
>>>>>             message: "$STAGE_NAME stage failed."
>>>>>          )
>>>>>       }
>>>>>   }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> -- 
>>>> 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/76f4796b-9bee-455f-8c95-decdff8da6fb%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/76f4796b-9bee-455f-8c95-decdff8da6fb%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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/4c7b1a85-8fde-435a-bee2-45275b787aa1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/4c7b1a85-8fde-435a-bee2-45275b787aa1%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/f8dd7c08-6f2c-4948-ad28-583fbc2dfb77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to