-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use java hudson.remoting.jnlp.Main
not java -jar agent.jar
#125
Conversation
</f:entry> | ||
<f:entry title="Windows Command" field="windowsCommand"> | ||
<f:textbox value="${dockerSwarmAgentTemplate.windowsCommand}" default="powershell.exe & { Invoke-WebRequest -TimeoutSec 20 -OutFile agent.jar %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL%; if($?) { java -jar agent.jar -jnlpUrl %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JNLP_URL% -secret %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET% -noReconnect } }"/> | ||
<f:textbox value="${dockerSwarmAgentTemplate.windowsCommand}" default="powershell.exe & { Invoke-WebRequest -TimeoutSec 20 -OutFile agent.jar %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL%; if($?) { java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url %DOCKER_SWARM_PLUGIN_JENKINS_URL% -noreconnect %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET% %DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME% } }"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows version untested.
@@ -10,10 +10,10 @@ | |||
<f:textbox value="${dockerSwarmAgentTemplate.image}" default="java:8"/> | |||
</f:entry> | |||
<f:entry title="Unix Command" field="unixCommand"> | |||
<f:textarea value="${dockerSwarmAgentTemplate.unixCommand}" default="sh -cx curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL && java -jar agent.jar -jnlpUrl $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JNLP_URL -secret $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET -noReconnect -workDir /tmp"/> | |||
<f:textarea value="${dockerSwarmAgentTemplate.unixCommand}" default="sh -cx curl --connect-timeout 20 --max-time 60 -o agent.jar $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL && java -classpath agent.jar hudson.remoting.jnlp.Main -headless -url $DOCKER_SWARM_PLUGIN_JENKINS_URL -noreconnect -workDir /tmp $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_SECRET $DOCKER_SWARM_PLUGIN_JENKINS_AGENT_NAME"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending this PR, you can replace $DOCKER_SWARM_PLUGIN_JENKINS_URL
with ${DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL%%jnlpJars/agent.jar}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can or should?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, to rephrase & expand: if you are running 1.11 but wish to access Jenkins HTTP via a different host than the canonical root URL, for example because you are running in Kubernetes and Swarm is inside the network and connections to the Jenkins controller should not exit the network and then come back in via ingress, then it is possible to configure that using a command like the one above but since $DOCKER_SWARM_PLUGIN_JENKINS_URL
is not defined you would need to obtain the URL another way, such as with shell scripting ${DOCKER_SWARM_PLUGIN_JENKINS_AGENT_JAR_URL%%jnlpJars/agent.jar}
. When 1.12 defined the new variable, then you could switch to the simpler form suggested here.
Thanks, seems to make sense. |
As of jenkinsci/remoting#677 |
Allows agents to connect to a Jenkins controller using a non-public URL after jenkinsci/jenkins#4839. KostyaSha/yet-another-docker-plugin#288 (comment) gives some background.