forked from linagora/james-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattach-remotes
41 lines (31 loc) · 1.27 KB
/
attach-remotes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import hudson.model.Node.Mode
import hudson.slaves.*
import jenkins.model.Jenkins
//Handy debug logging
Jenkins.instance.nodes.each {
println "BEFORE - Agent: $it"
}
String[] agentList = ["ci-james-01",
"ci-james-02",
"ci-james-03",
"ci-james-04",
"ci-james-06",
"ci-james-07",
"james-charge-01",
"james-charge-02"]
agentList.each {
// There is a constructor that also takes a list of properties (env vars) at the end, but haven't needed that yet
DumbSlave dumb = new DumbSlave(it, // Agent name, usually matches the host computer's machine name
"remote dockerized worker", // Agent description
"/home/jenkins/build/", // Workspace on the agent's computer
"1", // Number of executors
Mode.EXCLUSIVE, // "Usage" field, EXCLUSIVE is "only tied to node", NORMAL is "any"
"remote", // Labels
new JNLPLauncher(), // Launch strategy, JNLP is the Java Web Start setting services use
RetentionStrategy.INSTANCE) // Is the "Availability" field and INSTANCE means "Always"
Jenkins.instance.addNode(dumb)
println "Agent '$it' created"
}
Jenkins.instance.nodes.each {
println "AFTER - Agent: $it"
}