How to define labels and executor thread count for docker-jnlp-slave?

瀏覽次數:141 次
跳到第一則未讀訊息

Kirill

未讀,
2017年8月21日 上午9:57:072017/8/21
收件者:Jenkins Developers
Hi folks,

I'd like to use docker-jnlp-slave in my docker-compose to spin up slaves for Jenkins master.
However, I didn't find a way to define the labels for the agent - seems that there's no parameter for that. The same for executor thread count.
Furthermore, the Main class of JNLP agent (https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/jnlp/Main.java) doesn't seem to support these parameters as well. However, in agent's details in UI you can define these things.

So is there still a way to define those on container start? Or maybe I should just use an empty busybox-style container calling create-node CLI command (e.g, https://stackoverflow.com/questions/42683324/create-jenkins-jlnp-slave-programmatically/42703928#42703928) to create a JNLP agent?

Carlos Sanchez

未讀,
2017年8月21日 上午9:59:532017/8/21
收件者:Jenkins Developers
that's all defined in jenkins side, not in the agent
you can use the swarm plugin for auto connections

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b4602caa-73e3-4fc5-b311-b0a9a0f91b26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oleg Nenashev

未讀,
2017年8月21日 下午1:25:322017/8/21
收件者:Jenkins Developers
+1. Remoting is a communication library, it does not carry Jenkins Node specifics inside.

понедельник, 21 августа 2017 г., 15:59:53 UTC+2 пользователь Carlos Sanchez написал:
that's all defined in jenkins side, not in the agent
you can use the swarm plugin for auto connections
On Mon, Aug 21, 2017 at 3:57 PM, Kirill <yam...@gmail.com> wrote:
Hi folks,

I'd like to use docker-jnlp-slave in my docker-compose to spin up slaves for Jenkins master.
However, I didn't find a way to define the labels for the agent - seems that there's no parameter for that. The same for executor thread count.
Furthermore, the Main class of JNLP agent (https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/jnlp/Main.java) doesn't seem to support these parameters as well. However, in agent's details in UI you can define these things.

So is there still a way to define those on container start? Or maybe I should just use an empty busybox-style container calling create-node CLI command (e.g, https://stackoverflow.com/questions/42683324/create-jenkins-jlnp-slave-programmatically/42703928#42703928) to create a JNLP agent?

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Kirill

未讀,
2017年8月22日 上午11:13:042017/8/22
收件者:Jenkins Developers
Thanks for your comments, guys, I have found a solution that combines the creation of slave and an agent launch.

Just in case someone needs it.

1. Have an XML jnlp_slave.xml with slave description containing executor thread count and labels, e.g.

<slave>
  <remoteFS>/opt/jenkins2</remoteFS>
  <numExecutors>2</numExecutors>
  <launcher class="hudson.slaves.JNLPLauncher" />
  <label>fat</label>
</slave>

2. Run the following script to start agent (considering that http://jenkins:8080/jenkins/ is a Jenkins main page):

wget http://jenkins:8080/jenkins/jnlpJars/jenkins-cli.jar
cat jnlp_slave.xml | java -jar jenkins-cli.jar -s http://jenkins:8080/jenkins/ create-node my-agent
slaveComputerMac=`echo 'println jenkins.model.Jenkins.instance.nodesObject.getNode("my-agent")?.computer?.jnlpMac' | java -jar jenkins-cli.jar -s http://jenkins:8080/jenkins/ groovy =`
docker run jenkinsci/jnlp-slave -url http://jenkins:8080/jenkins/ ${slaveComputerMac} my-agent

Regards,
K.

понедельник, 21 августа 2017 г., 14:57:07 UTC+1 пользователь Kirill написал:
回覆所有人
回覆作者
轉寄
0 則新訊息