You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A jenkins workspace is a directory where a build does work
Jenkins lets you configure this per slave
if a pipeline does work in a workspace, we cannot specify a dpcli volume because we would need jenkins to setup the volume on the slave before calling the build, which would need a tighter integration.
since, builds can run in containers,
Inside a node definition in a pipeline we can create a workspace like so.
node('label'){
//now you are on slave labeled with 'label'
def workspace = pwd()
//${workspace} will now contain an absolute path to job workspace on slave
// OR
//now you are on slave labeled with 'label'
def workspace = $(dpcli create volume --snapshot <snapshot> && dpcli get volume-path)
//${workspace} will now contain an absolute path to created workspace on the slave
}
Given this, we can do something like the following.
node('label'){
//now you are on slave labeled with 'label'
def volume = $(dpcli create volume --snapshot <snapshot> && dpcli get volume-path)
def workspace = pwd()
docker.image('httpd').withRun('"-v ${volume}":"${workspace}"' {c ->
sh "doing something within a FlockerHub Snapshot mapped to the jenkins workspace in a
container."
}
}
The text was updated successfully, but these errors were encountered:
Inside a
node
definition in a pipeline we can create a workspace like so.This article (https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/chapter-docker-workflow.html) tells us we can use docker args in
inside()
or better yet we can usedocker
without the syntax, both are achievable the same way.Given this, we can do something like the following.
The text was updated successfully, but these errors were encountered: