hey, thanks guys! you're absolutely right. I made a file, wrote the 
information to that file, then instructed a later job to read that file

On Friday, April 16, 2021 at 7:58:03 AM UTC-5 Harry G. wrote:

> Yes, a file would be a valid way - still you have to get that file in this 
> pipeline, e.g. by copy artifacts plugin.
>
> By far easier would be if you switch to scripted pipeline and run the 
> variable modification directly in this pipeline instead of a separate job.
> Then you could get a file or simply a return value from the script 
> directly.
>
> jochen....@gmail.com schrieb am Donnerstag, 15. April 2021 um 09:35:53 
> UTC+2:
>
>> How about writing the value to a temporary file instead? A shell
>> script could use the file later on (in another stage) to set the
>> environment variable.
>>
>> On Wed, Apr 14, 2021 at 9:01 PM webde...@gmail.com
>> <webde...@gmail.com> wrote:
>> >
>> > hey, all!
>> >
>> > Here's what I would like to do:
>> >
>> > 1. in the pipeline itself, create an environment variable.
>> > 2. pass that environment variable to a job
>> > 3. that job will overwrite the environment variable's value at the top 
>> level
>> > 4. a later job will use this new value within its execution.
>> >
>> > something like:
>> >
>> > pipeline {
>> > agent {
>> > label 'Computer'
>> > }
>> >
>> > environment {
>> > 1. pipelineVariable = "15" 3. (after the changeVariableValue job, 
>> variable value is now 7)
>> > }
>> >
>> > stages {
>> > stage('change variable value') {
>> > steps {
>> > script {
>> > 2 build job: changeVariableValue
>> > parameter: [[$class: 'StringParameterValue', name: 'PipelineVariable', 
>> """${pipelineVariable}"""]]
>> > }
>> > }
>> > }
>> > stage('new variable value') {
>> > steps {
>> > script {
>> > 4 build job: newVariableValue parameter: [[$class: 
>> 'StringParameterValue', name: 'PipelineVariable', 
>> """${pipelineVariable}"""]]
>> > }
>> > }
>> > }
>> > }
>> > }
>> >
>> > The jobs are written in Powershell.
>> >
>> > Is there a way to do 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 jenkinsci-use...@googlegroups.com.
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/13fe1896-18d5-4566-99b6-5b1044b7934cn%40googlegroups.com
>> .
>>
>>
>>
>> -- 
>>
>> Look, that's why there's rules, understand? So that you think before
>> you break 'em.
>>
>> -- (Terry Pratchett, Thief of Time)
>>
>

-- 
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/1177cc5a-ef74-43ea-8871-777b45ca768bn%40googlegroups.com.

Reply via email to