-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: docker-workflow-plugin
-
Environment:Jenkins 2.32.3
BlueOcean 1.0.0-rc1
I don't believe this is a duplicate of JENKINS-28317Â but I haven't been able to figure out if I have that version of the plugin installed on my jenkins, because I'm not sure what plugin that applies to.
Â
I had a `withEnv` section that looked like:
def flowContext(cl) {
withEnv([
'npm_config_cache=npm-cache',
'npm_config_registry=http://npm.artifactory.mycompany.com/artifactory/api/npm/npm',
'http_proxy=http://proxy.mycompany.com:8080',
'https_proxy=http://proxy.mycompany.com:8080',
'HTTP_PROXY=http://proxy.mycompany.com:8080',
'HTTPS_PROXY=http://proxy.mycompany.com:8080',
'PROXY_HOST=proxy.mycompany.com',
'PROXY_PORT=8080',
'no_proxy=.mycompany.com'
]) {
credentialsContext(cl)
}
}
def credentialsContext(cl) {
withCredentials([
usernamePassword(
credentialsId: 'service-account-user-pass',
passwordVariable: 'SVC_PASS',
usernameVariable: 'SVC_USER'
),
usernamePassword(
credentialsId: 'github-auth-token',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USERNAME'
),
usernamePassword(
credentialsId: 'service-account-maven-artifactory-token',
passwordVariable: 'ARTIFACTORY_USER',
usernameVariable: 'ARTIFACTORY_TOKEN'
),
usernamePassword(
credentialsId: 'service-account-maven-artifactory-password',
passwordVariable: 'ARTIFACTORY_USER',
usernameVariable: 'ARTIFACTORY_PASSWORD'
),
string(credentialsId: 'slack-webhook', variable: 'SLACK_WEBHOOK_URL'),
string(credentialsId: 'tracker-token', variable: 'TRACKER_TOKEN')
]) {
cl()
}
}
The credentials context is another function that exports a few credentials into the environment.
All of the credentials would be there, but not all of the environment variables.
This would be executed within a docker container like so:
stage('Node Build') {
docker.image(ciNode).inside() {
//Do the node installs in parallel, because the npm install is the slowest part, and we can use lots of cpu
parallel(
"Root Npm Install/Build": {
flowContext {
sh('env')
sh('npm install')
sh('gulp')
}
},
"webapp/static Install/Build": {
flowContext {
echo "Due to bug: https://issues.jenkins-ci.org/browse/JENKINS-33510"
sh('cd src/main/webapp/static && npm install')
sh('cd src/main/webapp/static && grunt prod')
}
},
failFast: true
)
}
}
The sh('env') command within the flowContext would never show the no_proxy environment variable. I eventually gave up on trying to get it set in the Jenkinsfile, and instead put it in the root container image.