-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins 2.10, HTTP Request Plugin 1.8.11
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>)
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 channelCompare: https://github.com/jenkinsci/http-request-plugin/compare/a5124c6fef73...7f0b14ca136e