• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ansible-tower-plugin
    • None
    • Ansible Tower Plugin version 0.5.3
      Ansible AWX version 1.0.1

      Typing in single Job Tags or comma-separated multiple Job Tags in the Job Tags field of the Plugin don't pass through to the corresponding AWX/Ansible Tower Job Template.  The other fields like limits and extra vars, however, have been tested to work okay.

      Expected Results:

      Tasks should be limited to run based on their specific job tags.

      Actual Results:

      The entire playbook is running, with the job unaware of job tags being specified.

      Note: Job Tags specified directly in AWX Job Templates will run the tasks as expected.

          [JENKINS-48377] Job Tags don't pass to Ansible Tower/AWX

          Alvin Wong added a comment -

          I am not sure what happened, but the scheduled  jenkins jobs successfully passed job tags into AWX.  Will keep monitoring over the next couple days seeing if it's an issue with my environment.

          Alvin Wong added a comment - I am not sure what happened, but the scheduled  jenkins jobs successfully passed job tags into AWX.  Will keep monitoring over the next couple days seeing if it's an issue with my environment.

          John Westcott added a comment -

          Let me know. In my testing tonight (on Tower 3.2.1) I needed to start the tags with a ',' to get tower to accept it (this was true even when launching the job from Tower itself). If this works for you I can make a change to check for a leading ',' and add one if its not there.

          Also, I'm thinking about changing the code so that it will print a warn message if one of the fields is defined (like Tags) but the Prompt on Launch option is not checked for that type of input.

          Let me know your thoughts and how your testing works out.

          John Westcott added a comment - Let me know. In my testing tonight (on Tower 3.2.1) I needed to start the tags with a ',' to get tower to accept it (this was true even when launching the job from Tower itself). If this works for you I can make a change to check for a leading ',' and add one if its not there. Also, I'm thinking about changing the code so that it will print a warn message if one of the fields is defined (like Tags) but the Prompt on Launch option is not checked for that type of input. Let me know your thoughts and how your testing works out.

          Alvin Wong added a comment - - edited

          I'm still not exactly sure why this is happening now, but if I try to build jobs manually, it looks like the plugin will kick off the job template in AWX, but won't override the extra variables, limits, or job tags.  Here are some picture examples:

          Jenkins Job:

          AWX Job:

          Again, when jobs are triggered automatically by polling the SCM upstream in Jenkins, then settings pass through to AWX.  However, I can't even recreate that scenario manually as when I simply try to kick off the plugin from an upstream Jenkins job manually, it seems that nothing really happens other than triggering the existing job template with its existing settings in AWX.

           

          Alvin Wong added a comment - - edited I'm still not exactly sure why this is happening now, but if I try to build jobs manually, it looks like the plugin will kick off the job template in AWX, but won't override the extra variables, limits, or job tags.  Here are some picture examples: Jenkins Job: AWX Job: Again, when jobs are triggered automatically by polling the SCM upstream in Jenkins, then settings pass through to AWX.  However, I can't even recreate that scenario manually as when I simply try to kick off the plugin from an upstream Jenkins job manually, it seems that nothing really happens other than triggering the existing job template with its existing settings in AWX.  

          Code changed in jenkins
          User: John Westcott IV
          Path:
          src/main/java/org/jenkinsci/plugins/ansible_tower/util/TowerConnector.java
          http://jenkins-ci.org/commit/ansible-tower-plugin/885e792ca71d185e911764b6ca92cf120d978a60
          Log:
          Changes for JENKINS-48438 and JENKINS-48377.
          Added method to get job template and options for logging different types of events in a workflow. Tower running now will let you know if you set a variable that is not set as prompt on launch in Tower.

          Compare: https://github.com/jenkinsci/ansible-tower-plugin/compare/db71a93388c5...885e792ca71d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: John Westcott IV Path: src/main/java/org/jenkinsci/plugins/ansible_tower/util/TowerConnector.java http://jenkins-ci.org/commit/ansible-tower-plugin/885e792ca71d185e911764b6ca92cf120d978a60 Log: Changes for JENKINS-48438 and JENKINS-48377 . Added method to get job template and options for logging different types of events in a workflow. Tower running now will let you know if you set a variable that is not set as prompt on launch in Tower. Compare: https://github.com/jenkinsci/ansible-tower-plugin/compare/db71a93388c5...885e792ca71d

          John Westcott added a comment -

          The logic behind a scheduled job/upstream job/etc should be identical for a manually kicked off job. I've added some logic which tries to detect if Jenkins can't pass values to Tower. Can you try the latest version and let me know if you get any messages in the logs? If not, and its still not working can you send me a screen grab of your template? Also, what version of AWX are you on? If its still not working I'll see if I can grab that and test with that specific version.

          John Westcott added a comment - The logic behind a scheduled job/upstream job/etc should be identical for a manually kicked off job. I've added some logic which tries to detect if Jenkins can't pass values to Tower. Can you try the latest version and let me know if you get any messages in the logs? If not, and its still not working can you send me a screen grab of your template? Also, what version of AWX are you on? If its still not working I'll see if I can grab that and test with that specific version.

          Alvin Wong added a comment -

          johnwestcottiv Well this is embarrassing, it turns out I didn't have "prompt on launch" on anything for my test jobs, so it was my issue of negligence and I can confirm that values are being passed now.  However, looking at my logs, messages didn't show up in regards to detecting unpassed values. 

          Currently working with AWX v1.0.1.203

          Alvin Wong added a comment - johnwestcottiv Well this is embarrassing, it turns out I didn't have "prompt on launch" on anything for my test jobs, so it was my issue of negligence and I can confirm that values are being passed now.  However, looking at my logs, messages didn't show up in regards to detecting unpassed values.  Currently working with AWX v1.0.1.203

          Alvin Wong added a comment -

          The Issue was user error of forgetting to check "prompt on launch" for values to be passed from Jenkins to AWX.

          Alvin Wong added a comment - The Issue was user error of forgetting to check "prompt on launch" for values to be passed from Jenkins to AWX.

          John Westcott added a comment -

          Alvin, I'm not sure why but it took quite a while for the new plugin to propagate out to the Jenkins Plugin Center. Can you see if you now see the updated version (5.4)? If so, can you install it and see if you can now get it to produce the warning messages if an input is defined but prompt on launch is not set for the job?

          John Westcott added a comment - Alvin, I'm not sure why but it took quite a while for the new plugin to propagate out to the Jenkins Plugin Center. Can you see if you now see the updated version (5.4)? If so, can you install it and see if you can now get it to produce the warning messages if an input is defined but prompt on launch is not set for the job?

          Alvin Wong added a comment -

          John, I downloaded 5.4 and re-ran my test jobs without "Prompt On Launch".  Where am I supposed to be seeing these warning messages? I've checked the console output for the individual builds and /var/log/jenkins/jenkins.log, but they both just indicate a Build Failure instead of showing warning messages that the Tower Jobs don't have "prompt on launch" set.

          Alvin Wong added a comment - John, I downloaded 5.4 and re-ran my test jobs without "Prompt On Launch".  Where am I supposed to be seeing these warning messages? I've checked the console output for the individual builds and /var/log/jenkins/jenkins.log, but they both just indicate a Build Failure instead of showing warning messages that the Tower Jobs don't have "prompt on launch" set.

          John Westcott added a comment -

          They should show up in the console log at the beginning of the Tower run:
          Beginning Ansible Tower Run on Prod Tower
          [WARNING]: Job Tags defined but prompt for tags on launch is not set in tower job
          Requesting tower to run job template Simple Test

          John Westcott added a comment - They should show up in the console log at the beginning of the Tower run: Beginning Ansible Tower Run on Prod Tower [WARNING] : Job Tags defined but prompt for tags on launch is not set in tower job Requesting tower to run job template Simple Test

            tokiwong Alvin Wong
            tokiwong Alvin Wong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: