diff --git a/lib/interface/cli/commands/argocd/uninstall.cmd.js b/lib/interface/cli/commands/argocd/uninstall.cmd.js new file mode 100644 index 000000000..f455d84d5 --- /dev/null +++ b/lib/interface/cli/commands/argocd/uninstall.cmd.js @@ -0,0 +1,53 @@ +/* eslint-disable max-len */ +const Command = require('../../Command'); +const unInstallRoot = require('../root/uninstall.cmd'); +const { downloadArgo } = require('../hybrid/helper'); +const { Runner, components } = require('../../../../binary'); + + +const unInstallAgentCmd = new Command({ + root: false, + parent: unInstallRoot, + command: 'argo', + description: 'Uninstall argo agent', + webDocs: { + category: 'Argo', + title: 'Uninstall', + weight: 100, + }, + builder: yargs => yargs + .env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv + .option('kube-context-name', { + describe: 'Name of the kubernetes context on which monitor should be uninstalled [$CF_ARG_KUBE_CONTEXT_NAME]', + }) + .option('kube-namespace', { + describe: 'Name of the namespace on which monitor should be uninstalled [$CF_ARG_KUBE_NAMESPACE]', + }), + handler: async (argv) => { + const { + 'kube-namespace': kubeNamespace, + 'kube-context-name': kubeContextName, + } = argv; + + const binLocation = await downloadArgo(); + const componentRunner = new Runner(binLocation); + + const commands = [ + 'uninstall', + ]; + + if (kubeContextName) { + commands.push('--kube-context-name'); + commands.push(kubeContextName); + } + + if (kubeNamespace) { + commands.push('--kube-namespace'); + commands.push(kubeNamespace); + } + + await componentRunner.run(components.argo, commands); + }, +}); + +module.exports = unInstallAgentCmd; diff --git a/package.json b/package.json index d8eb6c1ac..29663ab3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.71.8", + "version": "0.72.0", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,