如何在所有jenkins项目中获取/访问HTTP代理配置?

问题描述 投票:0回答:1

我是新来的,[[詹金斯版, 2.204.5。我在我的詹金斯上设置了[[HTTP代理配置,如下所示

enter image description here当时我正在构建项目时,我需要

Execute Shell

上的

HTTP代理配置

信息,例如代理服务器,端口,用户名,密码。请帮助我。我想在我的外壳上进行HTTP代理配置以在以下命令下运行:npm config set proxy http://<username><password>@proxy-server-url>:<port> npm config set https-proxy http://<username><password>@proxy-server-url>:<port>
jenkins jenkins-plugins http-proxy
1个回答
0
投票
pipeline { agent any stages { stage('Preparation') { steps { script { def p = jenkins.model.Jenkins.getInstance().proxy env['http_proxy'] = "http://${p.name}:${p.port}" env['https_proxy'] = env['http_proxy'] env['no_proxy'] = p.noProxyHost } } } stage('Build') { steps { sh 'docker build -t mms_builder_dockerrpm --build-arg http_proxy="${http_proxy}" --build-arg https_proxy="${https_proxy}" --build-arg no_proxy="${no_proxy}" .' } } }
© www.soinside.com 2019 - 2024. All rights reserved.