hi there,
I wrote a pipeline which is used to build code by docker run, however, i found the variable value cannot be passed to docker. Any help would be appreciated.
pipeline{
agent any
environment {
build_user_id = “11”
}
stages{
stage(‘build_user1’){
steps{
wrap([$class: ‘BuildUser’]) {
script{
env.build_user_id = env.BUILD_USER_ID
sh ‘echo $build_user_id’ # show correctly
sh ‘docker run -e build_user_id=$build_user_id test’ # value of build_user_id is empty
}
}
}
}
}
}