Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56250

Ansible Tower Plugin not injecting Environment Variables for later use

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          Hide
          johnwestcottiv John Westcott added a comment -

          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)

          Show
          johnwestcottiv John Westcott added a comment - 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)

            People

            Assignee:
            johnwestcottiv John Westcott
            Reporter:
            ataylor Alex Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: