Skip to content

Commit f1b6a45

Browse files
olegz-codefresh123pasha-codefresh
authored
CR-1351 Add kube-manifestpath in gitops instalation (#582)
* CR-1351 Add kube-manifestpath in gitops instalation * support proxy params Co-authored-by: 123 <git config --global user.name 123a.aladov@codefresh.io> Co-authored-by: pashavictorovich <pavel@codefresh.io>
1 parent 9580b62 commit f1b6a45

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

lib/interface/cli/commands/gitops/install.cmd.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const _ = require('lodash');
33
const Command = require('../../Command');
44
const installRoot = require('../root/install.cmd');
5-
const { downloadProvider } = require('../hybrid/helper');
5+
const { downloadProvider, detectProxy } = require('../hybrid/helper');
66
const { Runner, components } = require('../../../../binary');
77

88
const installArgoCmd = new Command({
@@ -52,16 +52,32 @@ const installArgoCmd = new Command({
5252
.option('kube-namespace', {
5353
describe: 'Namespace in Kubernetes cluster',
5454
})
55+
.option('kube-manifest-path', {
56+
describe: 'Path to k8s manifest yaml file',
57+
})
5558
.option('sync-mode', {
5659
choices: ['NONE', 'SELECT', 'CONTINUE_SYNC', 'ONE_TIME_SYNC'],
5760
describe: 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time',
5861
})
5962
.option('sync-apps', {
6063
array: true,
6164
describe: 'Applications to be synchronized',
65+
})
66+
.option('http-proxy', {
67+
describe: 'http proxy to be used in the runner',
68+
})
69+
.option('https-proxy', {
70+
describe: 'https proxy to be used in the runner',
6271
}),
6372
handler: async (argv) => {
64-
const { 'kube-config-path': kubeConfigPath, provider } = argv;
73+
let {
74+
// eslint-disable-next-line prefer-const
75+
'kube-config-path': kubeConfigPath,
76+
// eslint-disable-next-line prefer-const
77+
provider,
78+
'http-proxy': httpProxy,
79+
'https-proxy': httpsProxy,
80+
} = argv;
6581

6682
const binLocation = await downloadProvider({ provider });
6783
const componentRunner = new Runner(binLocation);
@@ -75,7 +91,7 @@ const installArgoCmd = new Command({
7591
commands.push(kubeConfigPath);
7692
}
7793

78-
const installOptions = _.pick(argv, ['git-integration', 'codefresh-integration', 'argo-host', 'argo-token',
94+
const installOptions = _.pick(argv, ['git-integration', 'codefresh-integration', 'argo-host', 'argo-token', 'kube-manifest-path',
7995
'argo-username', 'argo-password', 'update', 'kube-context-name', 'kube-namespace', 'sync-mode', 'sync-apps']);
8096

8197
_.forEach(installOptions, (value, key) => {
@@ -90,6 +106,21 @@ const installArgoCmd = new Command({
90106
}
91107
});
92108

109+
const detectedProxyVars = detectProxy();
110+
httpProxy = httpProxy || detectedProxyVars.httpProxy;
111+
httpsProxy = httpsProxy || detectedProxyVars.httpsProxy;
112+
113+
if (httpProxy) {
114+
commands.push('--http-proxy');
115+
commands.push(httpProxy);
116+
}
117+
118+
if (httpsProxy) {
119+
commands.push('--https-proxy');
120+
commands.push(httpsProxy);
121+
}
122+
123+
93124
await componentRunner.run(components.gitops[provider], commands);
94125
},
95126
});

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.73.14",
3+
"version": "0.73.15",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)