Skip to content

Commit

Permalink
argocd agent update flags (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-codefresh authored Dec 1, 2020
1 parent a4f20d6 commit 3ea200e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/binary/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ module.exports = {
branch: 'master',
repo: 'argocd-agent',
},
}
},
},
};
35 changes: 33 additions & 2 deletions lib/interface/cli/commands/gitops/upgrade.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;

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.73.21",
"version": "0.73.22",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 3ea200e

Please sign in to comment.