Environment variables in docker agent args (pipeline)

34 views
Skip to first unread message

Antoine Cotten

unread,
Nov 22, 2017, 8:06:30 AM11/22/17
to Jenkins Users
Hi Jenkins experts,

My first experiment with the Pipeline plugin was to execute a build step inside a Docker container, configured as agent, but I'm unable to use Jenkins' standard variables in my agent configuration.

With the following code I'm trying to mount the current workspace to a specific destination:


stages {
  stage
('Build') {
    agent
{
      docker
{
        image
'golang:1.9'
        args
'-v $WORKSPACE:/go/src/github.com/foo/bar'
   
}
 
}
}

This simply doesn't work, the target directory is created by Docker but remains empty, although my workspace does contain the code pulled from my SCM.

Any tips?
Thanks!
Reply all
Reply to author
Forward
0 new messages