Mathieu Dumoulin
Mathieu Dumoulin

Reputation: 12244

Groovy withEnv interpolation not working

We are re-setting up our Jenkins server cause we had a stupid crash and lost all of our configuration. (Backups are now planned)

On of the first items of our multibranch pipeline groovy script is:

withEnv(['LB_PROJECT_ROOT=$WORKSPACE']) {

I put a

sh 'env'

just before that and i can see that WORKSPACE is set to a proper values. The path is allright and exists on the build node but the interpolation is not done in LB_PROJECT_ROOT. Instead, LB_PROJECT_ROOT ends up with the value "$WORKSPACE" which is failing our builds.

We are wondering if it might be a missing pluggin that could be doing that. Both "sh 'env'" before and after show that WORKSPACE is set and LB_PROJECT_ROOT is set only after the withEnv (Which makes sense) but with the wrong value!

Upvotes: 3

Views: 3678

Answers (1)

burnettk
burnettk

Reputation: 14047

Maybe double quote the 'LB_PROJECT_ROOT=$WORKSPACE' instead of single quote?

Upvotes: 6

Related Questions