jenkinsci / jenkinsci/parameterized-trigger-plugin
[JENKINS-55282] Parameterized Trigger plugin not passing user created environment variables
- Dominant language
- Java
- Stars
- 77
- Forks
- 174
- Avg merge
- 22h 27m
- Merged PRs (30d)
- 1
Description
I have an upstream Jenkins job which has a Powershell build step which passes a variable into the env.properties file using echo LATEST_BUILD_NUM_VAL=$LATEST_BUILD_NO_SLASH >> env.properties (NOTE: this is not the Jenkins build number but the one from our product under test). This is injected as an environment variable by an Inject Environment Variable build step. This user created environment variable appears to be being created successfully as it is shown in the builds environment variables list.
I have then tried to pass this user created environment variable to a downstream job using the Parameterized Trigger plugin and this parameter: LATEST_BUILD_NUM = ${LATEST_BUILD_NUM_VAL} (NOTE: this is not the Jenkins build number but the one from our product under test).
The issue is that although the user created environment variable value is present in the upstream build i.e. 165, all that gets passed to the downstream build as the matching environment variable is ${LATEST_BUILD_NUM_VAL}. To prove this is related to it a user created environment variable issue, if I pass a Jenkins created environment variable i.e. LATEST_BUILD_NUM = ${JOB_BASE_NAME} the correct environment variable value Test-Job-Receiver gets passed to the downstream build.
I am pretty confident that I am implementing this scenario correctly, so I can only come to the conclusion that this is a bug related to it being a user created environment variable.
---
Originally reported by jimlin, imported from: Parameterized Trigger plugin not passing user created environment variables
Raw content of original issue
I have an upstream Jenkins job which has a Powershell build step which passes a variable into the env.properties file using echo LATEST_BUILD_NUM_VAL=$LATEST_BUILD_NO_SLASH >> env.properties (NOTE: this is not the Jenkins build number but the one from our product under test). This is injected as an environment variable by an Inject Environment Variable build step. This user created environment variable appears to be being created successfully as it is shown in the builds environment variables list.
I have then tried to pass this user created environment variable to a downstream job using the Parameterized Trigger plugin and this parameter: LATEST_BUILD_NUM = ${LATEST_BUILD_NUM_VAL} (NOTE: this is not the Jenkins build number but the one from our product under test).
The issue is that although the user created environment variable value is present in the upstream build i.e. 165, all that gets passed to the downstream build as the matching environment variable is ${LATEST_BUILD_NUM_VAL}. To prove this is related to it a user created environment variable issue, if I pass a Jenkins created environment variable i.e. LATEST_BUILD_NUM = ${JOB_BASE_NAME} the correct environment variable value Test-Job-Receiver gets passed to the downstream build.
I am pretty confident that I am implementing this scenario correctly, so I can only come to the conclusion that this is a bug related to it being a user created environment variable.
environment
```
Jenkins v2.121.3
Parameterized Trigger plugin v2.35.2
```
5 attachments
- [PS and inject env variable build steps.png](https://issues.jenkins.io/secure/attachment/45515/PS%20and%20inject%20env%20variable%20build%20steps.png)
> 
- [Upstream Jenkins created env variable received in downstream job.png](https://issues.jenkins.io/secure/attachment/45517/Upstream%20Jenkins%20created%20env%20variable%20received%20in%20downstream%20job.png)
> 
- [Upstream Jenkins created env variable.png](https://issues.jenkins.io/secure/attachment/45518/Upstream%20Jenkins%20created%20env%20variable.png)
> 
- [Upstream env variable received in downstream job.png](https://issues.jenkins.io/secure/attachment/45519/Upstream%20env%20variable%20received%20in%20downstream%20job.png)
> 
- [Upstream user created environment variable.png](https://issues.jenkins.io/secure/attachment/45516/Upstream%20user%20created%20environment%20variable.png)
> 
Contributor guide
Assessment
This issue has not been assessed yet.