Environment variables in docker agent args (pipeline)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Environment variables in docker agent args (pipeline)

Antoine Cotten
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!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c011ba05-e781-481f-b733-4f5dcb488b97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.