Hello
I have a freestyle project that runs a batch file which does the build job. During execution of that batch file, some information are evaluated and assigned to the environment variables VERSION and VERSION_ID.
After the batch file is terminated I trigger a second parametrized freestyle project and I pass the values of these environment variable as parameters.
Here is what I did:
- I create the required environment variables using Environment Injector plugin.
2.Then I run my batch file. (Note that the expected values of the variables are printed to the console output!) - I run the second job with the variables passed as parameters
But the values passed to the second job are the initial values from the first screenshot and not the updated value after the batch file execution.
Same happens when i echo out the values in a second batch file step.
What am I doing wrong?
I also tried it with a pipeline, where information evaluated by TEST_JOB_A should be passed to TEST_JOB_B. But I have no idea how to achieve this.
pipeline {
agent none
stages {
stage('Build') {
steps {
build job: 'TEST_JOB_A', parameters: [string(name: 'PARAMETER_A', value: "testA")]
}
}
stage('Create Installer') {
steps {
build job: 'TEST_JOB_B', parameters: [string(name: 'VERSION', value: env.VERSION), string(name: 'VERSION_ID', value: env.VERSION_ID), string(name: 'BUILD_NR', value: env.BUILD_NUMBER)]
}
}
}
}
Has someone an idea?
Thanks in advance!
Mario