-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78fcb35
commit 7f8b0d2
Showing
4 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* eslint-disable max-len */ | ||
const Command = require('../../Command'); | ||
const installRoot = require('../root/install.cmd'); | ||
const { downloadArgo } = require('../hybrid/helper'); | ||
const { Runner, components } = require('../../../../binary'); | ||
|
||
const installArgoCmd = new Command({ | ||
root: false, | ||
parent: installRoot, | ||
command: 'argo', | ||
description: 'Install argo agent', | ||
webDocs: { | ||
category: 'Argo', | ||
title: 'Install', | ||
weight: 100, | ||
}, | ||
builder: yargs => yargs | ||
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv | ||
.option('token', { | ||
describe: 'Codefresh user token', | ||
}) | ||
.option('kube-context-name', { | ||
describe: 'Name of the kubernetes context on which monitor should be installed [$CF_ARG_KUBE_CONTEXT_NAME]', | ||
}) | ||
.option('url', { | ||
describe: 'Codefresh url, by default https://g.codefresh.io', | ||
}) | ||
.option('kube-namespace', { | ||
describe: 'Name of the namespace on which monitor should be installed [$CF_ARG_KUBE_NAMESPACE]', | ||
}) | ||
.option('argo-host', { | ||
describe: 'Argocd host, exaple is https://argohost.com', | ||
}) | ||
.option('argo-username', { | ||
describe: 'Argocd admin username', | ||
}) | ||
.option('argo-password', { | ||
describe: 'Argocd admin password', | ||
}), | ||
handler: async (argv) => { | ||
const { | ||
url, | ||
token, | ||
'kube-context-name': kubeContextName, | ||
'kube-namespace': kubeNamespace, | ||
'argo-host': argoHost, | ||
'argo-password': argoPassword, | ||
'argo-username': argoUsername, | ||
} = argv; | ||
const binLocation = await downloadArgo(); | ||
const componentRunner = new Runner(binLocation); | ||
|
||
const commands = [ | ||
'install', | ||
]; | ||
|
||
if (token) { | ||
commands.push('--codefresh-token'); | ||
commands.push(token); | ||
} | ||
|
||
if (kubeContextName) { | ||
commands.push('--kube-context-name'); | ||
commands.push(kubeContextName); | ||
} | ||
|
||
if (kubeNamespace) { | ||
commands.push('--kube-namespace'); | ||
commands.push(kubeNamespace); | ||
} | ||
|
||
if (url) { | ||
commands.push('--codefresh-host'); | ||
commands.push(url); | ||
} | ||
|
||
if (argoHost) { | ||
commands.push('--argo-host'); | ||
commands.push(argoHost); | ||
} | ||
|
||
if (argoPassword) { | ||
commands.push('--argo-password'); | ||
commands.push(argoPassword); | ||
} | ||
|
||
if (argoUsername) { | ||
commands.push('--argo-username'); | ||
commands.push(argoUsername); | ||
} | ||
|
||
|
||
await componentRunner.run(components.argo, commands); | ||
}, | ||
}); | ||
|
||
module.exports = installArgoCmd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters