Skip to content

Commit 7f42691

Browse files
add agent parameter (#574)
1 parent 383b5fc commit 7f42691

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed

lib/binary/components.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,23 @@ module.exports = {
3737
},
3838
},
3939
gitops: {
40-
name: 'gitops',
41-
description: 'Install gitops agent',
42-
version: {
43-
prefix: '',
44-
},
45-
local: {
46-
versionFile: 'version.txt',
47-
dir: 'gitops',
48-
binary: 'argocd-agent',
49-
},
50-
remote: {
51-
versionPath: 'installer',
52-
versionFile: 'VERSION',
53-
branch: 'master',
54-
repo: 'argocd-agent',
55-
},
40+
'argocd-agent': {
41+
name: 'gitops',
42+
description: 'Install gitops argocd agent',
43+
version: {
44+
prefix: '',
45+
},
46+
local: {
47+
versionFile: 'version.txt',
48+
dir: 'gitops',
49+
binary: 'argocd-agent',
50+
},
51+
remote: {
52+
versionPath: 'installer',
53+
versionFile: 'VERSION',
54+
branch: 'master',
55+
repo: 'argocd-agent',
56+
},
57+
}
5658
},
5759
};

lib/interface/cli/commands/gitops/install.cmd.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable max-len */
22
const Command = require('../../Command');
33
const installRoot = require('../root/install.cmd');
4-
const { downloadArgo } = require('../hybrid/helper');
4+
const { downloadProvider } = require('../hybrid/helper');
55
const { Runner, components } = require('../../../../binary');
66

77
const installArgoCmd = new Command({
88
root: false,
99
parent: installRoot,
10-
command: 'gitops',
10+
command: 'gitops <provider>',
1111
description: 'Install gitops agent',
1212
webDocs: {
1313
category: 'Gitops',
@@ -16,13 +16,18 @@ const installArgoCmd = new Command({
1616
},
1717
builder: yargs => yargs
1818
.env('CF_ARG_')
19+
.positional('provider', {
20+
describe: 'Gitops provider',
21+
choices: ['argocd-agent'],
22+
required: true,
23+
})
1924
.option('kube-config-path', {
2025
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
2126
}),
2227
handler: async (argv) => {
23-
const { 'kube-config-path': kubeConfigPath } = argv;
28+
const { 'kube-config-path': kubeConfigPath, provider } = argv;
2429

25-
const binLocation = await downloadArgo();
30+
const binLocation = await downloadProvider({ provider });
2631
const componentRunner = new Runner(binLocation);
2732

2833
const commands = [
@@ -34,7 +39,7 @@ const installArgoCmd = new Command({
3439
commands.push(kubeConfigPath);
3540
}
3641

37-
await componentRunner.run(components.gitops, commands);
42+
await componentRunner.run(components.gitops[provider], commands);
3843
},
3944
});
4045

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ async function downloadVeonona(location = CODEFRESH_PATH) {
356356
return location;
357357
}
358358

359-
async function downloadArgo(location = CODEFRESH_PATH) {
359+
async function downloadProvider({ provider, location = CODEFRESH_PATH }) {
360360
const downloader = new Downloader({
361361
progress: new cliProgress.SingleBar(
362362
{
@@ -367,9 +367,10 @@ async function downloadArgo(location = CODEFRESH_PATH) {
367367
),
368368
location,
369369
});
370-
const [error] = await to(downloader.download(components.gitops));
370+
const [error] = await to(downloader.download(components.gitops[provider]));
371371
if (error) {
372-
const newLocation = path.join(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER, components.gitops.local.dir, components.gitops.local.binary);
372+
const localSettings = components.gitops[provider].local;
373+
const newLocation = path.join(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER, localSettings.dir, localSettings.binary);
373374
if (await pathExists(newLocation)) {
374375
console.log('Failed to download installer, using binary from components folder');
375376
return path.resolve(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER);
@@ -930,7 +931,7 @@ module.exports = {
930931
downloadRelatedComponents: downloadHybridComponents,
931932
downloadSteveDore,
932933
downloadVeonona,
933-
downloadArgo,
934+
downloadProvider,
934935
runUpgrade,
935936
detectProxy,
936937
serealizeToKeyValuePairs,

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.73.8",
3+
"version": "0.73.9",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)