Skip to content

Commit

Permalink
ability delete argocd agent (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
pasha-codefresh authored Aug 4, 2020
1 parent 7f8b0d2 commit 3301091
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions lib/interface/cli/commands/argocd/uninstall.cmd.js
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.71.8",
"version": "0.72.0",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 3301091

Please sign in to comment.