john-westcott-iv / ansible-tower-plugin

Jenkins ansible tower plugin
MIT License
4 stars 42 forks source link

Origin of api calls made with this plugin #12

Open perzizzle opened 1 year ago

perzizzle commented 1 year ago

It appears that any api calls made from this plugin originate from the jenkins controller not from the jenkins agent with the specified label.

Given the following pipeline:

pipeline {
    agent {
        label 'production'
    }
    stages {
        stage('Trigger job in Production') {
            steps {
                script {
                    ansibleTower(
                        towerServer: 'Production Tower',
                        templateType: 'job',
                        jobTemplate: "Hello World",
                        importTowerLogs: true,
                        removeColor: false,
                        verbose: true,
                    )
                }
            }
        }
    }
}

Results in the following console output.

Running on [agent hostname]
2022-11-17 14:52:53 [Pipeline] {
2022-11-17 14:52:53 [Pipeline] stage
2022-11-17 14:52:53 [Pipeline] { (Trigger job in Datacenter)
2022-11-17 14:52:53 [Pipeline] script
2022-11-17 14:52:53 [Pipeline] {
2022-11-17 14:52:53 [Pipeline] ansibleTower
2022-11-17 14:52:53 Beginning Ansible Tower Run on Production
2022-11-17 14:57:08 ERROR: Unable to lookup job template Unable to find job template: Unable to make Tower HEAD request for /api/o/: Connection timed out (Connection timed out)
2022-11-17 14:57:08 [Pipeline] } 

But when I look at the firewalls I can see these requests originate from the jenkins controller not the "production" jenkins agent.

Has anyone found a way to route these requests via a jenkins agent?