Skip to content

Commit 2e41b10

Browse files
fix runner init with proxy (#528)
1 parent a281b04 commit 2e41b10

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ const initCmd = new Command({
134134
.option('set-file', {
135135
describe: 'Set values for templates from file, example: --set-file Storage.GoogleServiceAccount=/path/to/service-account.json',
136136
})
137+
.option('http-proxy', {
138+
describe: 'http proxy to be used in the runner',
139+
})
140+
.option('https-proxy', {
141+
describe: 'https proxy to be used in the runner',
142+
})
137143
.option('verbose', {
138144
describe: 'Print logs',
139145
})
@@ -184,6 +190,8 @@ const initCmd = new Command({
184190
'set-default-runtime': shouldMakeDefaultRe,
185191
'exec-demo-pipeline': shouldExecutePipeline,
186192
'env-vars': envVars,
193+
'http-proxy': httpProxy,
194+
'https-proxy': httpsProxy,
187195
} = _argv;
188196

189197
if (envVars) {
@@ -197,7 +205,9 @@ const initCmd = new Command({
197205
'\nAfter getting the token you may run this command again with the [--token] option or use the \'codefresh auth\' command to create an authenticated context.');
198206
process.exit(1);
199207
}
200-
let { httpProxy, httpsProxy } = detectProxy();
208+
const detectedProxyVars = detectProxy();
209+
httpProxy = httpProxy || detectedProxyVars.httpProxy;
210+
httpsProxy = httpsProxy || detectedProxyVars.httpsProxy;
201211
if (noQuestions) {
202212
// use defaults
203213
kubeContextName = getKubeContext(kubeConfigPath);
@@ -230,20 +240,24 @@ const initCmd = new Command({
230240
validate: value => (value !== undefined && value !== '') || 'Please enter namespace\'s name',
231241
});
232242
}
233-
questions.push({
234-
type: 'input',
235-
name: 'httpProxy',
236-
default: httpProxy,
237-
message: 'HTTP proxy to be used by runner inside Kubernetes ?',
243+
if (httpProxy) {
244+
questions.push({
245+
type: 'input',
246+
name: 'httpProxy',
247+
default: httpProxy,
248+
message: 'HTTP proxy to be used by runner inside Kubernetes ?',
249+
});
250+
}
238251

239-
});
240-
questions.push({
241-
type: 'input',
242-
name: 'httpsProxy',
243-
default: httpsProxy,
244-
message: 'HTTPS proxy to be used by runner inside Kubernetes ?',
252+
if (httpsProxy) {
253+
questions.push({
254+
type: 'input',
255+
name: 'httpsProxy',
256+
default: httpsProxy,
257+
message: 'HTTPS proxy to be used by runner inside Kubernetes ?',
245258

246-
});
259+
});
260+
}
247261

248262
if (_.isUndefined(shouldMakeDefaultRe)) {
249263
if (!_.get(sdk, 'config.context.isNoAuth') && await isNewAccount()) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.70.2",
3+
"version": "0.70.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)