Hello folks…
Problem I want to solve:
I want to be able to dynamically provision workers for my Jenkins on the fly.
Solution/Workflow:
I have a plugin in Jenkins (will call it Jenkins Client to differentiate from other roles) that makes a call to another Jenkins called the Dispatcher. The Dispatcher has the dedicated workers that will be passed back to the Jenkins Client. How we do this is on the Dispatcher, is by executing a Job that runs the slave.jar with the jnlpurl pass in from the Jenkins Client.
The Job on the Dispatcher looks like this:
- Execute shell:
java -jar slave.jar -jnlpUrl $JnlpUrl
- $JnlpUrl is a Job parameter
The Jenkins Client then gets the worker and executes the Job.
The worker on the Jenkins Client is set to disconnect after a few minutes of idle time.
The Issue:
On the Dispatcher, the Job that gets executed, runs for ever. I want the Dispatcher’s job to end.
In the logs of the Job I see:
…INFO: ConnectedDec 8, 2011 8:46:39 AM hudson.remoting.jnlp.Main$CuiListener statusINFO: TerminatedDec 8, 2011 8:46:49 AM hudson.remoting.jnlp.Main$CuiListener statusINFO: Locating server among [http://xxxxxxxxxxxx/builds]Dec 8, 2011 8:46:49 AM hudson.remoting.jnlp.Main$CuiListener statusINFO: Connecting to xxx.xxx.xxx.xx:xxxxDec 8, 2011 8:46:49 AM hudson.remoting.jnlp.Main$CuiListener statusINFO: HandshakingDec 8, 2011 8:46:49 AM hudson.remoting.jnlp.Main$CuiListener statusINFO: Connected…Continues on forever…
On the Jenkins Client, the Job has completed, the worker has terminated by idling out but the Dispatcher keeps the Job going.
I would like the Dispatcher Job to end once it hits Terminated and not reconnect.
In the slave.jar, there is a –noreconnect option.
But I am not able to use it because it does not find that option.
Does anyone know how to call slave.jar with –noreconnect set to true?
C:\mywork\Development\mbuild_csc>java -jar slave.jar -jnlpUrl http://127.0.0.1 -noreconnect true
“-noreconnect” is not a valid option
java -jar slave.jar [options...]
-auth user:pass : If your Hudson is security-enabeld, specify a
valid user name and password.
-connectTo HOST:PORT : make a TCP connection to the given host and
port, then start communication.
-cp (-classpath) PATH : add the given classpath elements to the
system classloader.
-jnlpCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making
HTTP requests.
-jnlpUrl URL : instead of talking to the master via
stdin/stdout, emulate a JNLP client by making
a TCP connection to the master. Connection
parameters are obtained by parsing the JNLP
file.
-tcp FILE : instead of talking to the master via
stdin/stdout, listens to a random local port,
write that port number to the given file,
then wait for the master to connect to that
port.
-text : encode communication with the master with
base64. Useful for running slave over 8-bit
unsafe protocol like telnet
I am using version 1.410 of Jenkins.
Any thoughts, really appreciate it.
Thanks.
Eladio
Hello folks…
In my logs when I execute slave.jar over jnlp… I see the following repeated:
Dec 13, 2011 8:58:10 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to x.y.z:n
Dec 13, 2011 8:58:10 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Dec 13, 2011 8:58:10 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
Dec 13, 2011 8:58:10 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Terminated
Is there a way to have slave.jar just exit and not reconnect endlessly?
Thanks.
Eladio