-
Bug
-
Resolution: Fixed
-
Major
-
None
Issue:
When creating a ENV variable within the Ansible Tower plugin API calls on a pipeline, that ENV variable is not usable inside of subsequent steps for Jenkins.
Steps to reproduce:
1. Create a Pipeline job with an Ansible Tower step
2. Inside of that step call an ansible script which uses the suggested line:
- name: Set a Jenkins variable
debug:
msg: "JENKINS_EXPORT VAR_NAME=value"
3. Try to echo that `VAR_NAME` using an `echo ${env.VAR_NAME} in a new stage
4. Observe the variable comes back as "null"
I even tried to expand the scope of the variable name using a `withEnv(['VAR_NAME=""']) {` at the beginning but that still does not work
Expected Result:
I would expect to see a ENV variable later in the pipeline but maybe the scope of that variable is only for within the ansible script?
[JENKINS-56250] Ansible Tower Plugin not injecting Environment Variables for later use
Description |
Original:
Issue: When creating a ENV variable within the Ansible Tower plugin API calls on a pipeline, that ENV variable is not usable inside of subsequent steps for Jenkins. Steps to reproduce: 1. Create a job with an Ansible Tower step 2. Inside of that step call an ansible script which uses the suggested line: {code:java} - name: Set a Jenkins variable debug: msg: "JENKINS_EXPORT VAR_NAME=value" {code} 3. Try to echo that `VAR_NAME` using an `echo ${env.VAR_NAME} in a new stage 4. Observe the variable comes back as "null" I even tried to expand the scope of the variable name using a `withEnv(['VAR_NAME=""']) {` at the beginning but that still does not work Expected Result: I would expect to see a ENV variable later in the pipeline but maybe the scope of that variable is only for within the ansible script? |
New:
Issue: When creating a ENV variable within the Ansible Tower plugin API calls on a pipeline, that ENV variable is not usable inside of subsequent steps for Jenkins. Steps to reproduce: 1. Create a Pipeline job with an Ansible Tower step 2. Inside of that step call an ansible script which uses the suggested line: {code:java} - name: Set a Jenkins variable debug: msg: "JENKINS_EXPORT VAR_NAME=value" {code} 3. Try to echo that `VAR_NAME` using an `echo ${env.VAR_NAME} in a new stage 4. Observe the variable comes back as "null" I even tried to expand the scope of the variable name using a `withEnv(['VAR_NAME=""']) {` at the beginning but that still does not work Expected Result: I would expect to see a ENV variable later in the pipeline but maybe the scope of that variable is only for within the ansible script? |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Open [ 1 ] | New: Fixed but Unreleased [ 10203 ] |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Closed [ 6 ] |
This should be fixed in the next version of the plugin (to be released soon). In a pipeline you will be able to do something like:
results = ansibleTower( ... )
println(results.variable_name)