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

Ansible Tower Plugin version 0.10.0 does not pass credentials from job to Ansible tower 3.6.1

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • ansible-tower-plugin
    • None
    • jenkins version :2.15.0, ansible tower plugin version:0.10.0, Ansible tower version 3.16.1
    • 0.14.1

      Ansible Tower Plugin version 0.10.0 does not pass credentials from jenkins job to Ansible tower 3.6.1 version

          [JENKINS-61586] Ansible Tower Plugin version 0.10.0 does not pass credentials from job to Ansible tower 3.6.1

          Hi John,

          it is not passing Machine type credentials from job to Ansible tower

          Lakshmi Prasanna Damineni added a comment - Hi John, it is not passing Machine type credentials from job to Ansible tower

          can you please provide me the solution as soon as possible here the issue is critical

          Lakshmi Prasanna Damineni added a comment - can you please provide me the solution as soon as possible here the issue is critical

          John Westcott added a comment -

          Could you please provide more details as to what is happening? Are you getting an error back from the plugin? Is your playbook throwing an error?

          John Westcott added a comment - Could you please provide more details as to what is happening? Are you getting an error back from the plugin? Is your playbook throwing an error?

          Hi John,

           

          while I am trying to push machine type credentials from Jenkins job to ansible tower ,Credentials are not displaying in ansible tower job template.only  I have this issue with machine type credentials .

          currently I am using ansible tower plugin version 0.10 and ansible tower version 3.6

           

          while I am trying with ansible tower plugin version with 0.14.0 getting Java Null Pointer exception

           

          can you please help me to get out of this issue

          Lakshmi Prasanna Damineni added a comment - Hi John,   while I am trying to push machine type credentials from Jenkins job to ansible tower ,Credentials are not displaying in ansible tower job template.only  I have this issue with machine type credentials . currently I am using ansible tower plugin version 0.10 and ansible tower version 3.6   while I am trying with ansible tower plugin version with 0.14.0 getting Java Null Pointer exception   can you please help me to get out of this issue

          Hi this comment by mistake assigned to me john can you please take look on it

          Lakshmi Prasanna Damineni added a comment - Hi this comment by mistake assigned to me john can you please take look on it

          John Westcott added a comment -

          We want to be using the latest version of the plugin. Are you getting a stack trace along with the Null Pointer Exception? If so, can you send that along? Also, are you referencing the credential by ID or by name?

          John Westcott added a comment - We want to be using the latest version of the plugin. Are you getting a stack trace along with the Null Pointer Exception? If so, can you send that along? Also, are you referencing the credential by ID or by name?

          Hi John,

          we are referencing credential by name, while using latest version plugin I am getting below error

          java.lang.NullPointerException
          at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.processCredentials(TowerConnector.java:518)
          at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.submitTemplate(TowerConnector.java:564)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerRunner.runJobTemplate(AnsibleTowerRunner.java:184)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:266)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:202)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE

          Lakshmi Prasanna Damineni added a comment - Hi John, we are referencing credential by name, while using latest version plugin I am getting below error java.lang.NullPointerException at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.processCredentials(TowerConnector.java:518) at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.submitTemplate(TowerConnector.java:564) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerRunner.runJobTemplate(AnsibleTowerRunner.java:184) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:266) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:202) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

          we are giving credentials in pipeline like below

          credential: 'nameofcredential'

          Lakshmi Prasanna Damineni added a comment - we are giving credentials in pipeline like below credential: 'nameofcredential'

          John Westcott added a comment -

          Thanks for the stack trace, it looks like the plugin was unable to determine the version of Tower you are connecting to. Can you go to Jenkins => Manage Jenkins => Configure System. On this page find the Ansible Tower section and check the "Enable Debugging" option next to the Tower installation you are running. After thats enabled tail your Jenkins log file and run your Jenkins job again. In the log file you should see messages that begin with the string `[Ansible-Tower]` like:
          ```
          [Ansible-Tower] Building GET request to https://10.0.1.24/api/v2/ping/
          [Ansible-Tower] Forcing cert trust
          [Ansible-Tower] Request completed with (200)
          [Ansible-Tower] Ping page loaded
          [Ansible-Tower] Successfully got version 3.6.2
          [Ansible-Tower] Connecting to Tower version: 3.6.2
          ```

          Please attach those first couple of lines so we can see if we are getting anything back.

          John Westcott added a comment - Thanks for the stack trace, it looks like the plugin was unable to determine the version of Tower you are connecting to. Can you go to Jenkins => Manage Jenkins => Configure System. On this page find the Ansible Tower section and check the "Enable Debugging" option next to the Tower installation you are running. After thats enabled tail your Jenkins log file and run your Jenkins job again. In the log file you should see messages that begin with the string ` [Ansible-Tower] ` like: ``` [Ansible-Tower] Building GET request to https://10.0.1.24/api/v2/ping/ [Ansible-Tower] Forcing cert trust [Ansible-Tower] Request completed with (200) [Ansible-Tower] Ping page loaded [Ansible-Tower] Successfully got version 3.6.2 [Ansible-Tower] Connecting to Tower version: 3.6.2 ``` Please attach those first couple of lines so we can see if we are getting anything back.

          I did all above steps but again I am getting below error

           

          java.lang.NullPointerException
          at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.processCredentials(TowerConnector.java:518)
          at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.submitTemplate(TowerConnector.java:564)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerRunner.runJobTemplate(AnsibleTowerRunner.java:184)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:266)
          at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:202)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE

          Lakshmi Prasanna Damineni added a comment - I did all above steps but again I am getting below error   java.lang.NullPointerException at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.processCredentials(TowerConnector.java:518) at org.jenkinsci.plugins.ansible_tower.util.TowerConnector.submitTemplate(TowerConnector.java:564) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerRunner.runJobTemplate(AnsibleTowerRunner.java:184) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:266) at org.jenkinsci.plugins.ansible_tower.AnsibleTowerStep$AnsibleTowerStepExecution.run(AnsibleTowerStep.java:202) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

          can you please tell the reason why the ansible tower plugin version 0.10 and 0.12 is not able to pass machine type of credentials to ansible tower,

          recently we upgraded ansible tower version after this we are facing this issue ,previously it is working with this plugin versions

          Lakshmi Prasanna Damineni added a comment - can you please tell the reason why the ansible tower plugin version 0.10 and 0.12 is not able to pass machine type of credentials to ansible tower, recently we upgraded ansible tower version after this we are facing this issue ,previously it is working with this plugin versions

          John Westcott added a comment -

          In Tower 3.5 they changed how credentials are passed through he API. The commit that tried to compensate for that was release as part of 0.14.0. https://github.com/jenkinsci/ansible-tower-plugin/commit/4f2dc4055519fc2c247897209af1a135bfe02864

          So we want to be using the latest version of the plugin to get those changes.

          The NPE exception you sent me is related to this line of code:
          `this.towerVersion.is_greater_or_equal("3.5.0") ||`

           

          Which is telling me that the module was unsuccessful at getting the details about your version of Tower. Can you log into Tower as the same user that the Jenkins plugin is using and then navigate to /api/v2/ping and paste the results into this ticket? I do see an issue where the plugin does not "complain" if its unable to get a version from Tower. But the ping page should be open to all users of Tower so that really shouldn't happen.

          John Westcott added a comment - In Tower 3.5 they changed how credentials are passed through he API. The commit that tried to compensate for that was release as part of 0.14.0.  https://github.com/jenkinsci/ansible-tower-plugin/commit/4f2dc4055519fc2c247897209af1a135bfe02864 So we want to be using the latest version of the plugin to get those changes. The NPE exception you sent me is related to this line of code: `this.towerVersion.is_greater_or_equal("3.5.0") ||`   Which is telling me that the module was unsuccessful at getting the details about your version of Tower. Can you log into Tower as the same user that the Jenkins plugin is using and then navigate to /api/v2/ping and paste the results into this ticket? I do see an issue where the plugin does not "complain" if its unable to get a version from Tower. But the ping page should be open to all users of Tower so that really shouldn't happen.

          Hi John,

           

          I did all above steps as per your response, getting like below.

           
          HTTP 200 OKAllow: GET, HEAD, OPTIONS*Content-Type:* application/json*Vary:* Accept*X-API-Node:* awx-77996979f4-gbtkn*X-API-Time:* 0.011s{"ha": false,"version": "8.0.0.0","active_node": "awx-77996979f4-gbtkn","install_uuid": "f04571db-6ac8-4e9e-8e2f-7f7ceaa1c834","instances": [

          {"node": "awx-77996979f4-gbtkn","uuid": "00000000-0000-0000-0000-000000000000","heartbeat": "2020-03-23T06:49:44.447859Z","capacity": 184,"version": "8.0.0.0"}

          ],"instance_groups": [

          {"name": "tower","capacity": 184,"instances": ["awx-77996979f4-gbtkn"]}

          ]}
           

          Lakshmi Prasanna Damineni added a comment - Hi John,   I did all above steps as per your response, getting like below.   HTTP 200 OK Allow: GET, HEAD, OPTIONS*Content-Type:* application/json*Vary:* Accept*X-API-Node:* awx-77996979f4-gbtkn*X-API-Time:* 0.011s{"ha": false,"version": "8.0.0.0","active_node": "awx-77996979f4-gbtkn","install_uuid": "f04571db-6ac8-4e9e-8e2f-7f7ceaa1c834","instances": [ {"node": "awx-77996979f4-gbtkn","uuid": "00000000-0000-0000-0000-000000000000","heartbeat": "2020-03-23T06:49:44.447859Z","capacity": 184,"version": "8.0.0.0"} ],"instance_groups": [ {"name": "tower","capacity": 184,"instances": ["awx-77996979f4-gbtkn"]} ]}  

          Hi John,

           

          for NPE the main issue is with towerVersion variable .

          I saw below comment on JENKINS-60352 issue 

          This patch cause a NullPointerException (with AWX) because towerVersion attribute is apparently not properly filled.

          Lakshmi Prasanna Damineni added a comment - Hi John,   for NPE the main issue is with towerVersion variable . I saw below comment on  JENKINS-60352 issue  This patch cause a NullPointerException (with AWX) because towerVersion attribute is apparently not properly filled.

          John Westcott added a comment -

          Thanks you for the details, I believe I know what is going on now and am working on a fix. I'll let you know when that has been pushed and is ready for testing. Hopefully that will be later today.

          John Westcott added a comment - Thanks you for the details, I believe I know what is going on now and am working on a fix. I'll let you know when that has been pushed and is ready for testing. Hopefully that will be later today.

          Hi John,

          Thank you for the update ,please let me know once it is done.

          Lakshmi Prasanna Damineni added a comment - Hi John, Thank you for the update ,please let me know once it is done.

          John Westcott added a comment -

          This appears to have been an issue specifically with AWX v8.0.0 which reported its version as 8.0.0.0 (a 4 part notation instead of a three part notation). Jenkins 0.14.1 has been released which should hopefully address this scenario. It may take a couple days to be available for download. Please test and let me know if this now works. 

          John Westcott added a comment - This appears to have been an issue specifically with AWX v8.0.0 which reported its version as 8.0.0.0 (a 4 part notation instead of a three part notation). Jenkins 0.14.1 has been released which should hopefully address this scenario. It may take a couple days to be available for download. Please test and let me know if this now works. 

          If it is taking couple of days to download then how we can test it

          Lakshmi Prasanna Damineni added a comment - If it is taking couple of days to download then how we can test it

          John Westcott added a comment -

          I just checked on the plugin site (https://plugins.jenkins.io/ansible-tower/) its still referencing 0.14.0 but on the Jenkins Update center (https://updates.jenkins.io/current/update-center.json) it looks like 0.14.1 is there. Please check your plugins page in Jenkins and see if the 0.14.1 version is available to you to test. If not, you may need to check over the next couple of days for it to become available. 

          John Westcott added a comment - I just checked on the plugin site ( https://plugins.jenkins.io/ansible-tower/ ) its still referencing 0.14.0 but on the Jenkins Update center ( https://updates.jenkins.io/current/update-center.json ) it looks like 0.14.1 is there. Please check your plugins page in Jenkins and see if the 0.14.1 version is available to you to test. If not, you may need to check over the next couple of days for it to become available. 

          I am not able to see 0.14.1 version in plugin page of Jenkins,
          Do you have any idea how many days it will take,
          Can I expect this version will handle machine credentials of ansible tower correctly

          Lakshmi Prasanna Damineni added a comment - I am not able to see 0.14.1 version in plugin page of Jenkins, Do you have any idea how many days it will take, Can I expect this version will handle machine credentials of ansible tower correctly

          John Westcott added a comment -

          I am hoping that the 0.14.1 will fix the issue with the extracting the version which is what is causing the machine credentials to fail. As for the number of days it can vary based on your installation. It appears to be published out on the plugin page but now its a matter of how long will that take to sync down to your installation. i.e. I've seen some installations which have additional proxies between Jenkins and the update center; I'd say to check back later tonight and then again tomorrow. You can also look at what your update center is set to and when your installation last checked for updates. To do this go to manage jenkins => manage plugins => advanced tab. The last field on here Update Site is where you are pulling plugins from and in the bottom right corner of the page there should be text indicating when the installation last pulled that source (i.e. Update information obtained: 4 hr 40 min ago). If that isn't recent you can hit the "check now" button and it should try to fetch the current data. I am seeing the 0.14.1 version of the plugin after hitting the check now button and my update site is set to the default: https://updates.jenkins.io/update-center.json

          John Westcott added a comment - I am hoping that the 0.14.1 will fix the issue with the extracting the version which is what is causing the machine credentials to fail. As for the number of days it can vary based on your installation. It appears to be published out on the plugin page but now its a matter of how long will that take to sync down to your installation. i.e. I've seen some installations which have additional proxies between Jenkins and the update center; I'd say to check back later tonight and then again tomorrow. You can also look at what your update center is set to and when your installation last checked for updates. To do this go to manage jenkins => manage plugins => advanced tab. The last field on here Update Site is where you are pulling plugins from and in the bottom right corner of the page there should be text indicating when the installation last pulled that source (i.e. Update information obtained: 4 hr 40 min ago). If that isn't recent you can hit the "check now" button and it should try to fetch the current data. I am seeing the 0.14.1 version of the plugin after hitting the check now button and my update site is set to the default:  https://updates.jenkins.io/update-center.json

          Hi John,

          Thank you very much for your support, finally it successfully passing machine credentials from Jenkins job to ansible tower

          Lakshmi Prasanna Damineni added a comment - Hi John, Thank you very much for your support, finally it successfully passing machine credentials from Jenkins job to ansible tower

            johnwestcottiv John Westcott
            lakshmi1 Lakshmi Prasanna Damineni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: