codefresh 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/binary/components.js +38 -0
- package/lib/interface/cli/commands/agent/helper.js +28 -0
- package/lib/interface/cli/commands/agent/install.cmd.js +283 -0
- package/lib/interface/cli/commands/agent/uninstall.cmd.js +92 -0
- package/lib/interface/cli/commands/app-proxy/helper.js +63 -0
- package/lib/interface/cli/commands/app-proxy/install.cmd.js +204 -0
- package/lib/interface/cli/commands/app-proxy/uninstall.cmd.js +175 -0
- package/lib/interface/cli/commands/app-proxy/upgrade.cmd.js +110 -0
- package/lib/interface/cli/commands/components/download.cmd.js +1 -1
- package/lib/interface/cli/commands/gitops/argocd/install.js +9 -0
- package/lib/interface/cli/commands/gitops/argocd/uninstall.js +11 -0
- package/lib/interface/cli/commands/gitops/argocd/upgrade.js +9 -0
- package/lib/interface/cli/commands/gitops/codefresh/install.js +50 -0
- package/lib/interface/cli/commands/gitops/codefresh/uninstall.js +14 -0
- package/lib/interface/cli/commands/gitops/codefresh/upgrade.js +9 -0
- package/lib/interface/cli/commands/gitops/common/install.js +62 -0
- package/lib/interface/cli/commands/gitops/common/uninstall.js +39 -0
- package/lib/interface/cli/commands/gitops/common/upgrade.js +45 -0
- package/lib/interface/cli/commands/gitops/install.cmd.js +116 -0
- package/lib/interface/cli/commands/gitops/install.spec.js +77 -0
- package/lib/interface/cli/commands/gitops/uninstall.cmd.js +56 -0
- package/lib/interface/cli/commands/gitops/upgrade.cmd.js +56 -0
- package/lib/interface/cli/commands/hybrid/delete.cmd.js +341 -0
- package/lib/interface/cli/commands/hybrid/helper.js +877 -1
- package/lib/interface/cli/commands/hybrid/init.cmd.js +957 -0
- package/lib/interface/cli/commands/hybrid/key-helper.js +82 -0
- package/lib/interface/cli/commands/hybrid/migration.js +192 -0
- package/lib/interface/cli/commands/hybrid/upgrade.cmd.js +195 -0
- package/lib/interface/cli/commands/monitor/install.cmd.js +160 -0
- package/lib/interface/cli/commands/monitor/uninstall.cmd.js +78 -0
- package/lib/interface/cli/commands/root/install.cmd.js +17 -0
- package/lib/interface/cli/commands/root/uninstall.cmd.js +17 -0
- package/lib/interface/cli/commands/runtimeEnvironments/attach.cmd.js +180 -0
- package/lib/interface/cli/commands/runtimeEnvironments/create.cmd.js +23 -0
- package/lib/interface/cli/commands/runtimeEnvironments/install.cmd.js +340 -0
- package/lib/interface/cli/commands/runtimeEnvironments/uninstall.cmd.js +149 -0
- package/lib/interface/cli/completion/tree.json +1 -1
- package/lib/interface/cli/helpers/kubernetes.js +61 -0
- package/lib/interface/cli/helpers/progressEvents.js +25 -0
- package/package.json +11 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const { downloadProvider } = require('../../hybrid/helper');
|
|
2
|
+
const { Runner, components } = require('../../../../../binary');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
class GitopsUninstaller {
|
|
6
|
+
// eslint-disable-next-line class-methods-use-this
|
|
7
|
+
async uninstall(provider, argv) {
|
|
8
|
+
const { 'kube-config-path': kubeConfigPath, 'bypass-download': bypassDownload } = argv;
|
|
9
|
+
const binLocation = await downloadProvider({ provider }, bypassDownload);
|
|
10
|
+
const componentRunner = new Runner(binLocation);
|
|
11
|
+
|
|
12
|
+
const commands = [
|
|
13
|
+
'uninstall',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
if (kubeConfigPath) {
|
|
17
|
+
commands.push('--kubeconfig');
|
|
18
|
+
commands.push(kubeConfigPath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const installOptions = _.omit(argv, 'kube-config-path');
|
|
22
|
+
|
|
23
|
+
_.forEach(_.pickBy(installOptions, _.identity), (value, key) => {
|
|
24
|
+
if (_.isArray(value)) {
|
|
25
|
+
value.forEach((item) => {
|
|
26
|
+
commands.push(`--${key}`);
|
|
27
|
+
commands.push(item);
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
commands.push(`--${key}`);
|
|
31
|
+
if (value !== true) commands.push(value);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
await componentRunner.run(components.gitops[provider], commands);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = new GitopsUninstaller();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const { downloadProvider } = require('../../hybrid/helper');
|
|
2
|
+
const { Runner, components } = require('../../../../../binary');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
class GitopsUpgrader {
|
|
6
|
+
// eslint-disable-next-line class-methods-use-this
|
|
7
|
+
async upgrade(argv) {
|
|
8
|
+
const {
|
|
9
|
+
provider,
|
|
10
|
+
'kube-config-path': kubeConfigPath,
|
|
11
|
+
'kube-namespace': kubeNamespace,
|
|
12
|
+
'kube-context-name': kubeContextName,
|
|
13
|
+
'in-cluster': inCluster,
|
|
14
|
+
'bypass-download': bypassDownload,
|
|
15
|
+
} = argv;
|
|
16
|
+
|
|
17
|
+
const binLocation = await downloadProvider({ provider }, bypassDownload);
|
|
18
|
+
const componentRunner = new Runner(binLocation);
|
|
19
|
+
|
|
20
|
+
const commands = [
|
|
21
|
+
'update',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
if (kubeConfigPath) {
|
|
25
|
+
commands.push('--kubeconfig');
|
|
26
|
+
commands.push(kubeConfigPath);
|
|
27
|
+
}
|
|
28
|
+
if (kubeNamespace) {
|
|
29
|
+
commands.push('--kube-namespace');
|
|
30
|
+
commands.push(kubeNamespace);
|
|
31
|
+
}
|
|
32
|
+
if (kubeContextName) {
|
|
33
|
+
commands.push('--kube-context-name');
|
|
34
|
+
commands.push(kubeContextName);
|
|
35
|
+
}
|
|
36
|
+
if (inCluster) {
|
|
37
|
+
commands.push('--in-cluster');
|
|
38
|
+
commands.push('true');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await componentRunner.run(components.gitops[provider], commands);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = new GitopsUpgrader();
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const Command = require('../../Command');
|
|
4
|
+
const installRoot = require('../root/install.cmd');
|
|
5
|
+
|
|
6
|
+
const PROVIDERS = {
|
|
7
|
+
codefresh: require('./codefresh/install'),
|
|
8
|
+
'argocd-agent': require('./argocd/install'),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const installArgoCmd = new Command({
|
|
12
|
+
root: false,
|
|
13
|
+
parent: installRoot,
|
|
14
|
+
command: 'gitops <provider>',
|
|
15
|
+
description: 'Install gitops',
|
|
16
|
+
webDocs: {
|
|
17
|
+
category: 'Gitops',
|
|
18
|
+
title: 'Install',
|
|
19
|
+
weight: 100,
|
|
20
|
+
},
|
|
21
|
+
builder: yargs => yargs
|
|
22
|
+
.env('CF_ARG_')
|
|
23
|
+
.positional('provider', {
|
|
24
|
+
describe: 'Gitops provider',
|
|
25
|
+
choices: ['codefresh', 'argocd-agent'],
|
|
26
|
+
required: true,
|
|
27
|
+
})
|
|
28
|
+
.option('git-integration', {
|
|
29
|
+
describe: 'Name of git integration in Codefresh',
|
|
30
|
+
})
|
|
31
|
+
.option('git-repo-url', {
|
|
32
|
+
describe: 'Url to manifest repo',
|
|
33
|
+
})
|
|
34
|
+
.option('codefresh-integration', {
|
|
35
|
+
describe: 'Name of gitops integration in Codefresh ( Please create a dedicated context for the agent to avoid hitting the Github rate limits )',
|
|
36
|
+
})
|
|
37
|
+
.option('argo-host', {
|
|
38
|
+
describe: 'Host of argocd installation',
|
|
39
|
+
})
|
|
40
|
+
.option('argo-token', {
|
|
41
|
+
describe: 'Token of argocd installation. Preferred auth method',
|
|
42
|
+
})
|
|
43
|
+
.option('argo-username', {
|
|
44
|
+
describe: 'Username of existing argocd installation. Should be used with argo-password',
|
|
45
|
+
})
|
|
46
|
+
.option('argo-password', {
|
|
47
|
+
describe: 'Password of existing argocd installation. Should be used with argo-username',
|
|
48
|
+
})
|
|
49
|
+
.option('update', {
|
|
50
|
+
describe: 'Update gitops integration if exists',
|
|
51
|
+
})
|
|
52
|
+
.option('kube-config-path', {
|
|
53
|
+
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
54
|
+
})
|
|
55
|
+
.option('kube-context-name', {
|
|
56
|
+
describe: 'Name of Kubernetes context',
|
|
57
|
+
})
|
|
58
|
+
.option('kube-namespace', {
|
|
59
|
+
describe: 'Namespace in Kubernetes cluster',
|
|
60
|
+
})
|
|
61
|
+
.option('in-cluster', {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
describe: 'Use this option if gitops provider is been updated from inside a cluster',
|
|
65
|
+
})
|
|
66
|
+
.option('output', {
|
|
67
|
+
describe: 'Path to k8s manifest output file, example: -o /home/user/out.yaml',
|
|
68
|
+
alias: 'o',
|
|
69
|
+
})
|
|
70
|
+
.option('sync-mode', {
|
|
71
|
+
choices: ['NONE', 'SELECT', 'CONTINUE_SYNC', 'ONE_TIME_SYNC'],
|
|
72
|
+
describe: 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time',
|
|
73
|
+
})
|
|
74
|
+
.option('sync-apps', {
|
|
75
|
+
array: true,
|
|
76
|
+
describe: 'Applications to be synchronized',
|
|
77
|
+
})
|
|
78
|
+
.option('http-proxy', {
|
|
79
|
+
describe: 'http proxy to be used in the runner',
|
|
80
|
+
})
|
|
81
|
+
.option('https-proxy', {
|
|
82
|
+
describe: 'https proxy to be used in the runner',
|
|
83
|
+
})
|
|
84
|
+
.option('install-manifest', {
|
|
85
|
+
describe: 'Url of argocd install manifest',
|
|
86
|
+
default: 'https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml',
|
|
87
|
+
})
|
|
88
|
+
.option('set-argo-password', {
|
|
89
|
+
describe: 'Set password for admin user of new argocd installation',
|
|
90
|
+
})
|
|
91
|
+
.option('codefresh-host', {
|
|
92
|
+
describe: 'Codefresh api host',
|
|
93
|
+
default: 'https://g.codefresh.io/',
|
|
94
|
+
})
|
|
95
|
+
.option('codefresh-agent-suffix', {
|
|
96
|
+
describe: 'Suffix for agent application\'s resources. Can be used for installing multiple agents in one namespace',
|
|
97
|
+
default: '',
|
|
98
|
+
})
|
|
99
|
+
.option('values', {
|
|
100
|
+
describe: 'Specify values in a YAML file',
|
|
101
|
+
})
|
|
102
|
+
.option('bypass-download', {
|
|
103
|
+
describe: 'Will bypass the attempt to download the installer. Instead, will immediately attempt to use the binary from the components folder',
|
|
104
|
+
default: false,
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
}),
|
|
107
|
+
|
|
108
|
+
handler: async (argv) => {
|
|
109
|
+
const { provider } = argv;
|
|
110
|
+
|
|
111
|
+
const providerInstaller = PROVIDERS[provider];
|
|
112
|
+
return providerInstaller.install(argv);
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
module.exports = installArgoCmd;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const installCmd = require('./install.cmd').toCommand();
|
|
2
|
+
const { Runner } = require('../../../../binary');
|
|
3
|
+
const yargs = require('yargs');
|
|
4
|
+
|
|
5
|
+
jest.mock('../hybrid/helper', () => ({
|
|
6
|
+
downloadProvider: async () => {},
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
jest.mock('../../../../binary');
|
|
10
|
+
|
|
11
|
+
describe('install gitops', () => {
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
Runner.mockClear();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('install gitops argocd-agent w/o arguments', async () => {
|
|
17
|
+
const argv = { provider: 'argocd-agent' };
|
|
18
|
+
await installCmd.handler(argv);
|
|
19
|
+
const { calls } = Runner.mock.instances[0].run.mock;
|
|
20
|
+
expect(calls).toHaveLength(1);
|
|
21
|
+
const [component, commands] = calls[0];
|
|
22
|
+
expect(component.name).toEqual('gitops');
|
|
23
|
+
expect(commands).toEqual(['install']);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('install gitops argocd-agent with arguments', async () => {
|
|
27
|
+
const argv = {
|
|
28
|
+
provider: 'argocd-agent',
|
|
29
|
+
'git-integration': 'gitIntegration',
|
|
30
|
+
'codefresh-integration': 'codefreshIntegration',
|
|
31
|
+
'kube-context-name': 'kubeContextName',
|
|
32
|
+
'kube-namespace': 'kubeNamespace',
|
|
33
|
+
'sync-mode': 'SELECT',
|
|
34
|
+
'sync-apps': 'syncApps',
|
|
35
|
+
};
|
|
36
|
+
await installCmd.handler(argv);
|
|
37
|
+
const { calls } = Runner.mock.instances[0].run.mock;
|
|
38
|
+
expect(calls).toHaveLength(1);
|
|
39
|
+
const [component, commands] = calls[0];
|
|
40
|
+
expect(component.name).toEqual('gitops');
|
|
41
|
+
expect(commands).toEqual([
|
|
42
|
+
'install',
|
|
43
|
+
'--git-integration',
|
|
44
|
+
'gitIntegration',
|
|
45
|
+
'--codefresh-integration',
|
|
46
|
+
'codefreshIntegration',
|
|
47
|
+
'--kube-context-name',
|
|
48
|
+
'kubeContextName',
|
|
49
|
+
'--kube-namespace',
|
|
50
|
+
'kubeNamespace',
|
|
51
|
+
'--sync-mode',
|
|
52
|
+
'SELECT',
|
|
53
|
+
'--sync-apps',
|
|
54
|
+
'syncApps',
|
|
55
|
+
]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('install gitops codefresh with required arguments', async () => {
|
|
59
|
+
const argv = {
|
|
60
|
+
provider: 'codefresh',
|
|
61
|
+
'set-argo-password': 'pass',
|
|
62
|
+
setArgoPassword: 'pass',
|
|
63
|
+
'kube-namespace': 'ns',
|
|
64
|
+
kubeNamespace: 'ns',
|
|
65
|
+
};
|
|
66
|
+
await installCmd.handler(argv);
|
|
67
|
+
const { calls } = Runner.mock.instances[0].run.mock;
|
|
68
|
+
expect(calls).toHaveLength(1);
|
|
69
|
+
const [component, commands] = calls[0];
|
|
70
|
+
expect(component.name).toEqual('cf-gitops-controller');
|
|
71
|
+
expect(commands).toEqual([
|
|
72
|
+
'install',
|
|
73
|
+
'--kube-namespace',
|
|
74
|
+
'ns',
|
|
75
|
+
]);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
const Command = require('../../Command');
|
|
3
|
+
const unInstallRoot = require('../root/uninstall.cmd');
|
|
4
|
+
const { downloadProvider } = require('../hybrid/helper');
|
|
5
|
+
const { Runner, components } = require('../../../../binary');
|
|
6
|
+
const codefreshProvider = require('./codefresh/uninstall');
|
|
7
|
+
const argocdAgentProvider = require('./argocd/uninstall');
|
|
8
|
+
|
|
9
|
+
const PROVIDERS = {
|
|
10
|
+
codefresh: codefreshProvider,
|
|
11
|
+
'argocd-agent': argocdAgentProvider,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const unInstallAgentCmd = new Command({
|
|
15
|
+
root: false,
|
|
16
|
+
parent: unInstallRoot,
|
|
17
|
+
command: 'gitops <provider>',
|
|
18
|
+
description: 'Uninstall gitops agent',
|
|
19
|
+
webDocs: {
|
|
20
|
+
category: 'Gitops',
|
|
21
|
+
title: 'Uninstall',
|
|
22
|
+
weight: 100,
|
|
23
|
+
},
|
|
24
|
+
builder: yargs => yargs
|
|
25
|
+
.env('CF_ARG_')
|
|
26
|
+
.positional('provider', {
|
|
27
|
+
describe: 'Gitops provider',
|
|
28
|
+
choices: Object.keys(PROVIDERS),
|
|
29
|
+
required: true,
|
|
30
|
+
})
|
|
31
|
+
.option('kube-config-path', {
|
|
32
|
+
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
33
|
+
})
|
|
34
|
+
.option('kube-context-name', {
|
|
35
|
+
describe: 'Name of Kubernetes context',
|
|
36
|
+
})
|
|
37
|
+
.option('kube-namespace', {
|
|
38
|
+
describe: 'Namespace in Kubernetes cluster',
|
|
39
|
+
})
|
|
40
|
+
.option('install-manifest', {
|
|
41
|
+
describe: 'Url of argocd install manifest',
|
|
42
|
+
default: 'https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml',
|
|
43
|
+
})
|
|
44
|
+
.option('in-cluster', {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
default: false,
|
|
47
|
+
describe: 'Use this option if gitops provider is been updated from inside a cluster',
|
|
48
|
+
}),
|
|
49
|
+
handler: async (argv) => {
|
|
50
|
+
const { provider } = argv;
|
|
51
|
+
const providerInstaller = PROVIDERS[provider];
|
|
52
|
+
return providerInstaller.uninstall(argv);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
module.exports = unInstallAgentCmd;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const Command = require('../../Command');
|
|
2
|
+
const upgradeRoot = require('../root/upgrade.cmd');
|
|
3
|
+
const codefreshProvider = require('./codefresh/upgrade');
|
|
4
|
+
const argocdAgentProvider = require('./argocd/upgrade');
|
|
5
|
+
|
|
6
|
+
const PROVIDERS = {
|
|
7
|
+
codefresh: codefreshProvider,
|
|
8
|
+
'argocd-agent': argocdAgentProvider,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const command = new Command({
|
|
12
|
+
root: false,
|
|
13
|
+
parent: upgradeRoot,
|
|
14
|
+
command: 'gitops <provider>',
|
|
15
|
+
description: 'Upgrade gitops agent',
|
|
16
|
+
webDocs: {
|
|
17
|
+
category: 'Gitops',
|
|
18
|
+
title: 'Upgrade',
|
|
19
|
+
weight: 100,
|
|
20
|
+
},
|
|
21
|
+
builder: (yargs) => {
|
|
22
|
+
yargs
|
|
23
|
+
.positional('provider', {
|
|
24
|
+
describe: 'Gitops provider',
|
|
25
|
+
choices: Object.keys(PROVIDERS),
|
|
26
|
+
required: true,
|
|
27
|
+
})
|
|
28
|
+
.option('kube-config-path', {
|
|
29
|
+
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
30
|
+
})
|
|
31
|
+
.option('kube-namespace', {
|
|
32
|
+
describe: 'Name of the namespace on which Argo agent should be updated',
|
|
33
|
+
})
|
|
34
|
+
.option('kube-context-name', {
|
|
35
|
+
describe: 'Name of the kubernetes context where Argo agent should be updated (default is current-context)',
|
|
36
|
+
})
|
|
37
|
+
.option('in-cluster', {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
describe: 'Use this option if gitops provider is been updated from inside a cluster',
|
|
41
|
+
})
|
|
42
|
+
.example(
|
|
43
|
+
'codefresh upgrade gitops argocd-agent',
|
|
44
|
+
'Update gitops agent',
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
handler: async (argv) => {
|
|
48
|
+
const { provider } = argv;
|
|
49
|
+
|
|
50
|
+
const providerInstaller = PROVIDERS[provider];
|
|
51
|
+
return providerInstaller.upgrade(argv);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
module.exports = command;
|
|
56
|
+
|