Skip to content

Instantly share code, notes, and snippets.

@mrbobbytables
Last active November 26, 2015 10:31
Show Gist options
  • Save mrbobbytables/46d3be64ccce59bce13d to your computer and use it in GitHub Desktop.
Save mrbobbytables/46d3be64ccce59bce13d to your computer and use it in GitHub Desktop.
jenkins-mesos-cloud
//groovy.init
import org.jenkinsci.plugins.mesos.*
def slaveVols = [
new MesosSlaveInfo.Volume(
containerPath="/usr/bin/docker",
hostPath="/usr/bin/docker",
readOnly=true
),
new MesosSlaveInfo.Volume(
containerPath="/var/run/docker.sock",
hostPath="/var/run/docker.sock",
readOnly=false
)
]
def slaveContainerInfo = new MesosSlaveInfo.ContainerInfo(
type="DOCKER",
dockerImage="mrbobbytables/jenkins-build-base",
dockerPrivilegedMode=false,
dockerForcePullImage=false,
useCustomDockerCommandShell=false,
customDockerCommandShell="",
volumes=slaveVols,
parameters=[],
networking="BRIDGE",
portMappings=[]
)
def dummyContainerInfo = new MesosSlaveInfo.ExternalContainerInfo(
image="",
options=""
)
def slaveContainers =[
new MesosSlaveInfo(
labelString="mesos",
mode=null,
slaveCpus="0.1",
slaveMem="512",
maxExecutors="1",
executorCpus="1",
executorMem="128",
remoteFSRoot="jenkins",
idleTerminationMinutes="3",
slaveAttributes="",
jvmArgs="-Xms16m -XX:+UseConcMarkSweepGC -Djava.net.preferIPv4Stack=true",
jnlpArgs="",
externalContainerInfo=dummyContainerInfo,
containerInfo=slaveContainerInfo,
additionalURIs=[]
)
]
def cloud = new MesosCloud(
nativeLibraryPath="/usr/lib/libmesos.so",
master="192.168.111.11:5050",
description="Jenkins in the Mesos",
frameworkName="Jenkins",
slavesUser="jenkins",
principal="jenkins",
secret="",
slaveInfos=slaveContainers,
checkpoint=true,
onDemandRegistration=true,
jenkinsURL=""
)
def cloudList = Jenkins.instance.clouds
cloudList.add(cloud)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment