[JIRA] (JENKINS-56250) Ansible Tower Plugin not injecting Environment Variables for later use

0 views
Skip to first unread message

ataylor@cloudbees.com (JIRA)

unread,
Feb 22, 2019, 11:41:02 AM2/22/19
to jenkinsc...@googlegroups.com
Alex Taylor created an issue
 
Jenkins / Bug JENKINS-56250
Ansible Tower Plugin not injecting Environment Variables for later use
Issue Type: Bug Bug
Assignee: John Westcott
Components: ansible-tower-plugin
Created: 2019-02-22 16:40
Priority: Major Major
Reporter: Alex Taylor

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:

 - 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?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ataylor@cloudbees.com (JIRA)

unread,
Feb 22, 2019, 11:42:02 AM2/22/19
to jenkinsc...@googlegroups.com
Alex Taylor updated an issue
Change By: Alex Taylor
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?

john.westcott.iv@redhat.com (JIRA)

unread,
Aug 13, 2019, 2:14:03 PM8/13/19
to jenkinsc...@googlegroups.com
John Westcott updated Bug JENKINS-56250
 

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)

Change By: John Westcott
Status: Open Fixed but Unreleased
Resolution: Fixed

john.westcott.iv@redhat.com (JIRA)

unread,
Jan 8, 2020, 9:54:03 AM1/8/20
to jenkinsc...@googlegroups.com
Change By: John Westcott
Status: Fixed but Unreleased Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages