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

httpRequest executes from Jenkins Master node

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: http-request-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.10, HTTP Request Plugin 1.8.11
    • Similar Issues:

      Description

      We use the EC2 Metadata API to retrieve the local host IP. Creating a new URL() object and getting the text from the result showed that it was running on the queueing machine. Fair enough, understandable for the groovy script to initially get executed on that one first.

      However, I then installed the httpRequest plugin, hoping that it would solve that problem. Nope.

          sh "curl -s http://169.254.169.254/latest/meta-data/public-ipv4 > public.txt"
          sh "curl -s http://169.254.169.254/latest/meta-data/local-ipv4 > private.txt"
          def nodePublicIP = readFile('public.txt')
          def nodePrivateIP = readFile('private.txt')
          sh "rm public.txt"
          sh "rm private.txt"
          def httpRequestPublicIP = httpRequest("http://169.254.169.254/latest/meta-data/public-ipv4").content
          def httpRequestPrivateIP = httpRequest("http://169.254.169.254/latest/meta-data/local-ipv4").content
      
          println "Running on host $nodePublicIP ($nodePrivateIP)"
          println "httpRequest says host $httpRequestPublicIP ($httpRequestPrivateIP)"
      

      Output:

      [Pipeline] echo
      Running on host <node public IP> (<node private IP>)
      [Pipeline] echo
      httpRequest says host <Jenkins master public IP> (<Jenkins master private IP>)
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Janario Oliveira
          Path:
          src/main/java/jenkins/plugins/http_request/HttpRequest.java
          src/main/java/jenkins/plugins/http_request/HttpRequestExecution.java
          src/main/java/jenkins/plugins/http_request/HttpRequestStep.java
          src/main/java/jenkins/plugins/http_request/ResponseContentSupplier.java
          src/main/java/jenkins/plugins/http_request/auth/Authenticator.java
          src/main/java/jenkins/plugins/http_request/util/HttpClientUtil.java
          src/main/java/jenkins/plugins/http_request/util/HttpRequestNameValuePair.java
          src/main/java/jenkins/plugins/http_request/util/RequestAction.java
          src/test/java/jenkins/plugins/http_request/HttpRequestStepTest.java
          src/test/java/jenkins/plugins/http_request/HttpRequestTest.java
          http://jenkins-ci.org/commit/http-request-plugin/7f0b14ca136e15109f279987cb9a6b67c1193537
          Log:
          #JENKINS-36486 - Moved execution to allow serialization and execution on node channel

          Compare: https://github.com/jenkinsci/http-request-plugin/compare/a5124c6fef73...7f0b14ca136e

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Janario Oliveira Path: src/main/java/jenkins/plugins/http_request/HttpRequest.java src/main/java/jenkins/plugins/http_request/HttpRequestExecution.java src/main/java/jenkins/plugins/http_request/HttpRequestStep.java src/main/java/jenkins/plugins/http_request/ResponseContentSupplier.java src/main/java/jenkins/plugins/http_request/auth/Authenticator.java src/main/java/jenkins/plugins/http_request/util/HttpClientUtil.java src/main/java/jenkins/plugins/http_request/util/HttpRequestNameValuePair.java src/main/java/jenkins/plugins/http_request/util/RequestAction.java src/test/java/jenkins/plugins/http_request/HttpRequestStepTest.java src/test/java/jenkins/plugins/http_request/HttpRequestTest.java http://jenkins-ci.org/commit/http-request-plugin/7f0b14ca136e15109f279987cb9a6b67c1193537 Log: # JENKINS-36486 - Moved execution to allow serialization and execution on node channel Compare: https://github.com/jenkinsci/http-request-plugin/compare/a5124c6fef73...7f0b14ca136e
          Hide
          janario Janario Oliveira added a comment -

          It wasn't executing on slave node :S

          I've changed to support it.

           

          Thanks for the report.

          Show
          janario Janario Oliveira added a comment - It wasn't executing on slave node :S I've changed to support it.   Thanks for the report.

            People

            Assignee:
            janario Janario Oliveira
            Reporter:
            jzila John Zila
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: