Skip to content

Commit ebe61dd

Browse files
olegz-codefresh123
andauthored
CR-620 Add postiional provider for update and uninstall gitops (#578)
Co-authored-by: 123 <git config --global user.name 123a.aladov@codefresh.io>
1 parent f2ad955 commit ebe61dd

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* eslint-disable max-len */
22
const Command = require('../../Command');
33
const unInstallRoot = require('../root/uninstall.cmd');
4-
const { downloadArgo } = require('../hybrid/helper');
4+
const { downloadProvider } = require('../hybrid/helper');
55
const { Runner, components } = require('../../../../binary');
66

77

88
const unInstallAgentCmd = new Command({
99
root: false,
1010
parent: unInstallRoot,
11-
command: 'gitops',
11+
command: 'gitops <provider>',
1212
description: 'Uninstall gitops agent',
1313
webDocs: {
1414
category: 'Gitops',
@@ -17,13 +17,18 @@ const unInstallAgentCmd = new Command({
1717
},
1818
builder: yargs => yargs
1919
.env('CF_ARG_')
20+
.positional('provider', {
21+
describe: 'Gitops provider',
22+
choices: ['argocd-agent'],
23+
required: true,
24+
})
2025
.option('kube-config-path', {
2126
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
2227
}),
2328
handler: async (argv) => {
24-
const { 'kube-config-path': kubeConfigPath } = argv;
29+
const { 'kube-config-path': kubeConfigPath, provider } = argv;
2530

26-
const binLocation = await downloadArgo();
31+
const binLocation = await downloadProvider({ provider });
2732
const componentRunner = new Runner(binLocation);
2833
const commands = [
2934
'uninstall',
@@ -34,7 +39,7 @@ const unInstallAgentCmd = new Command({
3439
commands.push(kubeConfigPath);
3540
}
3641

37-
await componentRunner.run(components.gitops, commands);
42+
await componentRunner.run(components.gitops[provider], commands);
3843
},
3944
});
4045

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const Command = require('../../Command');
22

33
const upgradeRoot = require('../root/upgrade.cmd');
4-
const { downloadArgo } = require('../hybrid/helper');
4+
const { downloadProvider } = require('../hybrid/helper');
55
const { Runner, components } = require('../../../../binary');
66

77
const command = new Command({
88
root: false,
99
parent: upgradeRoot,
10-
command: 'gitops',
10+
command: 'gitops <provider>',
1111
description: 'Upgrade gitops agent',
1212
webDocs: {
1313
category: 'Gitops',
@@ -16,6 +16,11 @@ const command = new Command({
1616
},
1717
builder: (yargs) => {
1818
yargs
19+
.positional('provider', {
20+
describe: 'Gitops provider',
21+
choices: ['argocd-agent'],
22+
required: true,
23+
})
1924
.option('kube-config-path', {
2025
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
2126
})
@@ -25,9 +30,8 @@ const command = new Command({
2530
);
2631
},
2732
handler: async (argv) => {
28-
const { 'kube-config-path': kubeConfigPath } = argv;
29-
30-
const binLocation = await downloadArgo();
33+
const { 'kube-config-path': kubeConfigPath, provider } = argv;
34+
const binLocation = await downloadProvider({ provider });
3135
const componentRunner = new Runner(binLocation);
3236

3337
const commands = [
@@ -39,7 +43,7 @@ const command = new Command({
3943
commands.push(kubeConfigPath);
4044
}
4145

42-
await componentRunner.run(components.gitops, commands);
46+
await componentRunner.run(components.gitops[provider], commands);
4347
},
4448
});
4549

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

0 commit comments

Comments
 (0)