forked from cloudbees/jenkins-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createPSEManagedMasterFromCode.groovy
33 lines (32 loc) · 1.64 KB
/
createPSEManagedMasterFromCode.groovy
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
/**
Create a Managed Master on PSE using code
Notes:
1./ This script has been tested for CJE1 (Mesosphere) -Legacy
2./ For Managed Team Management see: https://go.cloudbees.com/docs/cloudbees-documentation/admin-cje/cje-ux/#_command_line_interface
**/
import com.cloudbees.jce.masterprovisioning.mesos.MesosMasterProvisioning
import com.cloudbees.opscenter.server.model.ManagedMaster
import com.cloudbees.jce.masterprovisioning.mesos.HealthCheckConfiguration
import com.cloudbees.opscenter.server.properties.ConnectedMasterOwnerProperty
import com.cloudbees.opscenter.server.properties.ConnectedMasterLicenseServerProperty;
ManagedMaster instance = Jenkins.getInstance().createProject(ManagedMaster.class,'TestFromCode')
MesosMasterProvisioning mesos = new MesosMasterProvisioning()
mesos.setDomain('testfromcode')
mesos.setDisk(1)
mesos.setMemory(512)
mesos.setRatio(0.25)
mesos.setCpus(0.2)
mesos.setSystemProperties('''com.cloudbees.tiger.plugins.palace.PalaceCloud.maxInProvisioning=25
hudson.model.DirectoryBrowserSupport.CSP=""''')
HealthCheckConfiguration hc = new HealthCheckConfiguration()
hc.setGracePeriodSeconds(600)
hc.setIntervalSeconds(60)
mesos.setHealthCheckConfiguration(hc)
mesos.setImage('CloudBees Jenkins Enterprise 2.19.4.2')
instance.setConfiguration(mesos)
instance.setDescription('TestFromCode Description')
instance.setDisplayName('Test From Code Display Name')
instance.getProperties().add(new ConnectedMasterOwnerProperty('owners', Integer.MAX_VALUE))
instance.getProperties().replace(new ConnectedMasterLicenseServerProperty(new ConnectedMasterLicenseServerProperty.FloatingExecutorsStrategy()));
instance.save()
instance.provisionAndStartAction()