user1050619
user1050619

Reputation: 20856

setting environment variable in jenkins scripted pipeline

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

Upvotes: 0

Views: 1373

Answers (1)

chandu
chandu

Reputation: 385

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

Upvotes: 1

Related Questions