0

Im trying to set a environment variable(VIRTUALENV) in Jenkins - stage(check_style) and use that in the shell but it throws a error.

withEnv(['VIRTUAL_ENV=${env.WORKSPACE}/venv']){
            stage ('Check_style') {
                 sh """
                    export PATH=${VIRTUAL_ENV}/bin:${PATH}
                    make flake8 | tee report/flake8.log || true
                """
  }
  }

Error:-

PATH=${env.WORKSPACE}/venv/bin:/usr/bin:/bin:/usr/sbin:/sbin: bad substitution
user1050619
  • 19,822
  • 85
  • 237
  • 413
  • Possible duplicate of [What's the difference of strings within single or double quotes in groovy?](https://stackoverflow.com/questions/6761498/whats-the-difference-of-strings-within-single-or-double-quotes-in-groovy) – mkobit Jun 13 '18 at 19:09
  • 1
    Use single quotes – rohit thomas Jun 14 '18 at 05:10

1 Answers1

1

withEnv(["VIRTUAL_ENV=${env.WORKSPACE}/venv"]) should work

chandu
  • 375
  • 3
  • 16