jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-56883] Docker proxy is not set if it matches the host proxy
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
I found a bug that doesn't let me set the company proxy inside a docker container because it is defined on the host as well.
environment variable on the host:
https_proxy=mycompany.de:8080
pipeline {
agent {
label 'master'
}
stages {
stage('Azure Docker Image Build') {
steps {
withDockerContainer('microsoft/azure-cli') {
withEnv(['HTTPS_PROXY=mycompany.de:8080']) {
sh 'env'
}
}
}
}
}
}
I think the origin of this bug is this line: https://github.com/jenkinsci/docker-workflow-plugin/blob/648f335899c5229fb8a6e889739db9cfb15de890/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L130
Where every enivronment variable that matches the host variables is removed.
Currently the workaround is to explicitly set the environment variable:
withDockerContainer(args: '-e HTTPS_PROXY=mycompany.de:8080', image: 'microsoft/azure-cli') {
// some block
}
---
Originally reported by xaseron, imported from: Docker proxy is not set if it matches the host proxy
Raw content of original issue
I found a bug that doesn't let me set the company proxy inside a docker container because it is defined on the host as well.
environment variable on the host:
https_proxy=mycompany.de:8080
pipeline {
agent {
label 'master'
}
stages {
stage('Azure Docker Image Build') {
steps {
withDockerContainer('microsoft/azure-cli') {
withEnv(['HTTPS_PROXY=mycompany.de:8080']) {
sh 'env'
}
}
}
}
}
}I think the origin of this bug is this line: https://github.com/jenkinsci/docker-workflow-plugin/blob/648f335899c5229fb8a6e889739db9cfb15de890/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L130
Where every enivronment variable that matches the host variables is removed.
Currently the workaround is to explicitly set the environment variable:
withDockerContainer(args: '-e HTTPS_PROXY=mycompany.de:8080', image: 'microsoft/azure-cli') {
// some block
}
Contributor guide
Assessment
This issue has not been assessed yet.