From 3ea200e3a7244bbb429c96f3d46439d8329c0b2d Mon Sep 17 00:00:00 2001 From: andrii-codefresh <41997149+andrii-codefresh@users.noreply.github.com> Date: Tue, 1 Dec 2020 15:02:15 +0200 Subject: [PATCH] argocd agent update flags (#595) --- lib/binary/components.js | 2 +- .../cli/commands/gitops/upgrade.cmd.js | 35 +++++++++++++++++-- package.json | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/binary/components.js b/lib/binary/components.js index 73232a837..928c8b232 100644 --- a/lib/binary/components.js +++ b/lib/binary/components.js @@ -54,6 +54,6 @@ module.exports = { branch: 'master', repo: 'argocd-agent', }, - } + }, }, }; diff --git a/lib/interface/cli/commands/gitops/upgrade.cmd.js b/lib/interface/cli/commands/gitops/upgrade.cmd.js index b05035c75..d63f4ecb6 100644 --- a/lib/interface/cli/commands/gitops/upgrade.cmd.js +++ b/lib/interface/cli/commands/gitops/upgrade.cmd.js @@ -24,13 +24,31 @@ const command = new Command({ .option('kube-config-path', { describe: 'Path to kubeconfig file (default is $HOME/.kube/config)', }) + .option('kube-namespace', { + describe: 'Name of the namespace on which Argo agent should be updated', + }) + .option('kube-context-name', { + describe: 'Name of the kubernetes context where Argo agent should be updated (default is current-context)', + }) + .option('in-cluster', { + type: 'boolean', + default: false, + describe: 'Use this option if Argo agent is been updated from inside a cluster', + }) .example( - 'codefresh upgrade gitops', + 'codefresh upgrade gitops argocd-agent', 'Update gitops agent', ); }, handler: async (argv) => { - const { 'kube-config-path': kubeConfigPath, provider } = argv; + const { + provider, + 'kube-config-path': kubeConfigPath, + 'kube-namespace': kubeNamespace, + 'kube-context-name': kubeContextName, + 'in-cluster': inCluster, + } = argv; + const binLocation = await downloadProvider({ provider }); const componentRunner = new Runner(binLocation); @@ -42,9 +60,22 @@ const command = new Command({ commands.push('--kubeconfig'); commands.push(kubeConfigPath); } + if (kubeNamespace) { + commands.push('--kube-namespace'); + commands.push(kubeNamespace); + } + if (kubeContextName) { + commands.push('--kube-context-name'); + commands.push(kubeContextName); + } + if (inCluster) { + commands.push('--in-cluster'); + commands.push('true'); + } await componentRunner.run(components.gitops[provider], commands); }, }); module.exports = command; + diff --git a/package.json b/package.json index 573860ee6..e5435b354 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.73.21", + "version": "0.73.22", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,