Thanks Robert. However I'm not sure yet how this helps in solving the next 
step here. Namely:

> How can I then use this in combination with: 
https://github.com/jansepar/node-jenkins-api#build_with_params 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fjansepar%2Fnode-jenkins-api%23build_with_params&sa=D&sntz=1&usg=AFQjCNEuXKpvHxclHo7p8aWqWiMf2nOymw>
> ... the end goal is to trigger the job remotely with a parameter, and the 
parameter's value then needs to be used as an environment variable...

On Friday, September 22, 2017 at 6:42:35 AM UTC+3, Robert Hales wrote:
>
> The Parameters can be defined in the pipeline, or in the job 
> configuration, but if you define it in the pipeline, it will update the job 
> configuration the first time it runs. So when you add the parameters to the 
> pipeline, and have none configured in your job, your Build Now button will 
> still be Build Now. Run it once, things may fail and die. But now your job 
> will be configured with the parameters, and the Build Now link now says 
> Build with Parameters. I think it is cleaner to add any config possible in 
> the pipeline code. Also, if you change any property from the pipeline code, 
> it will change all properties in the job config, so if it wasn't specified 
> in the pipeline code, it will disable. So, for example, if you configure 
> the build discarder in the project, then configure parameters in the 
> pipeline code, you will lose your build discarder when the job runs. 
>
> To access the parameters in your pipeline, use the params object: 
>
> parameters {
>     string(defaultValue: 'master', description: 'Git Branch', name: 
> 'gitBranch')
> }
>
>
> ...
>
>
> myProperty = "${params.gitBranch}"
>
>
>
>
> On Wednesday, September 20, 2017 at 1:29:32 AM UTC-6, Idan Adar wrote:
>>
>> The following is my current pipeline:
>>
>> stage ("My Stage") {  
>>          environment {
>>             cloudcerts_iamConfig_preprod = credentials(
>> '${cloudcerts_iamConfig_preprod}')
>>          }
>>              
>>          steps {
>>                // Setup packages and run tests
>>                sh '''
>>                   npm install
>>                   npm test
>>                '''
>>          }
>> }
>>
>> During runtime of the tests, "cloudcerts_iamConfig_preprod" is available 
>> via process.env and everything is great.
>> My requirement now however is to add another property dynamically.
>>
>> To do this I ticked the checkbox "This project is parameterized" > String 
>> parameter, and provided a name and default value (myStringParameter, "xxx").
>> I then added to "environments":
>>
>> myProperty = ${myStringParameter)
>>
>> However when the tests run process.env.myProperty returns "undefined".
>> Is this the right way to pass the parameter? Is there a different way?
>>
>

-- 
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/8b4bed06-9b03-41cb-bee4-432bed087390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to