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-users+unsubscr...@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.

Reply via email to