Skip to content

Commit 4e9b9a2

Browse files
download components (#761)
* download components * eslint
1 parent b74ca12 commit 4e9b9a2

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const Command = require('../../Command');
2+
const componentsRoot = require('../root/components.cmd');
3+
const helper = require('../hybrid/helper');
4+
5+
const command = new Command({
6+
command: 'download',
7+
parent: componentsRoot,
8+
description: 'Download Codefresh CLI components',
9+
webDocs: {
10+
category: 'Components',
11+
title: 'Download',
12+
},
13+
builder: (yargs) => yargs
14+
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv
15+
.option('location', {
16+
describe: 'Override download folder location. Default: ~/.Codefresh',
17+
})
18+
.option('components', {
19+
describe: 'Components. List of [stevedore, venona, argocd-agent, codefresh]',
20+
}),
21+
handler: async (argv) => {
22+
console.log('Downloading components');
23+
const { location, components } = argv;
24+
await helper.downloadComponents(location, components);
25+
},
26+
});
27+
28+
module.exports = command;

lib/interface/cli/commands/hybrid/helper.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,33 @@ async function downloadHybridComponents(location, bypassDownload = false) {
420420
console.log(`Kubernetes registrator installer downloaded successfully ${location}`);
421421
}
422422

423+
/* eslint-disable no-restricted-syntax, no-await-in-loop */
424+
async function downloadComponents(location = CODEFRESH_PATH, componentsArray = []) {
425+
for (const component of componentsArray) {
426+
switch (component) {
427+
case 'stevedore':
428+
await downloadSteveDore(location);
429+
console.log(colors.green(`Kubernetes registrator installer downloaded successfully to ${location}`));
430+
break;
431+
case 'venona':
432+
await downloadVeonona(location);
433+
console.log(colors.green(`Kubernetes components installer downloaded successfully to ${location}`));
434+
break;
435+
case 'argocd-agent':
436+
await downloadProvider({ provider: 'argocd-agent', location });
437+
console.log(colors.green(`Argocd-agent downloaded successfully to ${location}`));
438+
break;
439+
case 'codefresh':
440+
await downloadProvider({ provider: 'codefresh', location });
441+
console.log(colors.green(`Codefresh gitops provider downloaded successfully to ${location}`));
442+
break;
443+
default:
444+
console.log(colors.yellow(`Skip unknown component ${component}`));
445+
}
446+
}
447+
}
448+
/* eslint-enable no-restricted-syntax, no-await-in-loop */
449+
423450
async function runClusterAcceptanceTests({
424451
apiHost,
425452
kubeNamespace,
@@ -1106,6 +1133,7 @@ module.exports = {
11061133
keyValueAsStringToObject,
11071134
objectToKeyValueArray,
11081135
downloadRelatedComponents: downloadHybridComponents,
1136+
downloadComponents,
11091137
downloadSteveDore,
11101138
downloadVeonona,
11111139
downloadProvider,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.80.2",
3+
"version": "0.80.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)