Skip to content

Commit f2ad955

Browse files
Cr 755 cli options (#576)
1 parent 2b64b82 commit f2ad955

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable max-len */
2+
const _ = require('lodash');
23
const Command = require('../../Command');
34
const installRoot = require('../root/install.cmd');
45
const { downloadProvider } = require('../hybrid/helper');
@@ -21,8 +22,43 @@ const installArgoCmd = new Command({
2122
choices: ['argocd-agent'],
2223
required: true,
2324
})
25+
.option('git-integration', {
26+
describe: 'Name of git integration in Codefresh',
27+
})
28+
.option('codefresh-integration', {
29+
describe: 'Name of argocd integration in Codefresh',
30+
})
31+
.option('argo-host', {
32+
describe: 'Host of argocd installation',
33+
})
34+
.option('argo-token', {
35+
describe: 'Token of argocd installation. Preferred auth method',
36+
})
37+
.option('argo-username', {
38+
describe: 'Username of argocd installation. Should be used with argo-password',
39+
})
40+
.option('argo-password', {
41+
describe: 'Username of argocd installation. Should be used with argo-username',
42+
})
43+
.option('update', {
44+
describe: 'Update argocd integration if exists',
45+
})
2446
.option('kube-config-path', {
2547
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
48+
})
49+
.option('kube-context-name', {
50+
describe: 'Name of Kubernetes context',
51+
})
52+
.option('kube-namespace', {
53+
describe: 'Namespace in Kubernetes cluster',
54+
})
55+
.option('sync-mode', {
56+
choices: ['NONE', 'SELECT', 'CONTINUE_SYNC', 'ONE_TIME_SYNC'],
57+
describe: 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time',
58+
})
59+
.option('sync-apps', {
60+
array: true,
61+
describe: 'Applications to be synchronized',
2662
}),
2763
handler: async (argv) => {
2864
const { 'kube-config-path': kubeConfigPath, provider } = argv;
@@ -39,6 +75,21 @@ const installArgoCmd = new Command({
3975
commands.push(kubeConfigPath);
4076
}
4177

78+
const installOptions = _.pick(argv, ['git-integration', 'codefresh-integration', 'argo-host', 'argo-token',
79+
'argo-username', 'argo-password', 'update', 'kube-context-name', 'kube-namespace', 'sync-mode', 'sync-apps']);
80+
81+
_.forEach(installOptions, (value, key) => {
82+
if (_.isArray(value)) {
83+
value.forEach((item) => {
84+
commands.push(`--${key}`);
85+
commands.push(item);
86+
});
87+
} else {
88+
commands.push(`--${key}`);
89+
if (value !== true) commands.push(value);
90+
}
91+
});
92+
4293
await componentRunner.run(components.gitops[provider], commands);
4394
},
4495
});

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

0 commit comments

Comments
 (0)