Hi did you guys every get to a resolution on this? I have exactly the same 
issue. 


On Friday, 5 May 2017 12:10:51 UTC+1, ishan jain wrote:
>
> Hi Eric,
>
> This the full code that copied earlier. You would only require to create a 
> properties file. The other echo statements that i have put are printing out 
> the values just fine. 
>
> On Thursday, 4 May 2017 22:47:14 UTC+2, Eric Pyle wrote:
>>
>> OK, so the variable is now being evaluated, but it is not set. Possibly a 
>> variable scoping issue? Can you post the exact code?
>>
>> On 5/4/2017 4:23 AM, ishan jain wrote:
>>
>> Hi Eric, 
>>
>> I tried putting the var in double quotes but still it is not able to 
>> resolve it. I get *'*There are no nodes with the label ‘null’' error. I 
>> am able to print the value of exact same variable but it seems it is not 
>> resolving the variable name in here. Is there something else i need to do 
>> here ?
>>
>> On Wednesday, 3 May 2017 17:51:21 UTC+2, Eric Pyle wrote: 
>>>
>>> It should work if you use double quotes around your agent variable. 
>>> Variable resolution will not happen within single quotes.
>>>
>>> On 5/3/2017 10:58 AM, ishan jain wrote:
>>>
>>> I am using declarative syntax to build my pipeline. I am loading several 
>>> variables from a properties file in the beginning and i now i would like to 
>>> control the 'on which slave node something executes' via variables. But i 
>>> cannot figure out how to use variable as a agent label. The following is 
>>> one of the snippets and like all its other variations, it fails:
>>>
>>> properties = null
>>>
>>> def loadProperties() {
>>>  node {
>>>          checkout scm
>>>            properties = readProperties file: 'pipeline.properties'
>>>         echo "Immediate one ${properties.repo}"
>>> }
>>> }
>>>
>>> pipeline {
>>>    agent none
>>>  
>>>      stages {
>>>        
>>>                stage ('prepare') {
>>>                     agent any
>>>                       
>>>                         steps {
>>>                         script {
>>>                                        loadProperties()
>>>                                }
>>>                       }
>>>               }
>>>               stage('Build') {
>>>            
>>>                    agent { label '${properties.agent}' }
>>>                   
>>>                         steps {
>>>                         sh 'hostname'
>>>                           echo properties.repo
>>>                    }
>>>                       
>>>         }
>>>    }
>>> }
>>>
>>>
>>> -- 
>>> 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/4cfff4fb-aa1f-4ad2-9017-d6dcf89a7b36%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/4cfff4fb-aa1f-4ad2-9017-d6dcf89a7b36%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> -- 
>>> Eric Pyle
>>> Siemens PLM Software
>>> Lebanon, NH
>>> +1 [email protected]http://www.siemens.com/plm
>>>
>>> -- 
>> 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/d96a65f5-9926-4325-9f02-1c4649330b06%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/d96a65f5-9926-4325-9f02-1c4649330b06%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> Eric Pyle
>> Siemens PLM Software
>> Lebanon, NH
>> +1 [email protected]http://www.siemens.com/plm
>>
>>

-- 
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/f61f808b-183c-4016-a8b7-416feca3e839%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to