codefresh 1.3.5 → 2.0.0
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 +0 -57
- package/lib/interface/cli/commands/agent/install.cmd.js +6 -126
- package/lib/interface/cli/commands/components/download.cmd.js +1 -1
- package/lib/interface/cli/commands/hybrid/execute-test-pipeline.cmd.js +37 -11
- package/lib/interface/cli/commands/hybrid/helper.js +8 -896
- package/lib/interface/cli/commands/runtimeEnvironments/attach.cmd.js +3 -103
- package/lib/interface/cli/commands/runtimeEnvironments/install.cmd.js +8 -134
- package/lib/interface/cli/completion/tree.json +1 -1
- package/lib/interface/cli/helpers/kubernetes.js +8 -42
- package/package.json +3 -22
- package/lib/interface/cli/commands/agent/uninstall.cmd.js +0 -92
- package/lib/interface/cli/commands/app-proxy/helper.js +0 -63
- package/lib/interface/cli/commands/app-proxy/install.cmd.js +0 -204
- package/lib/interface/cli/commands/app-proxy/uninstall.cmd.js +0 -175
- package/lib/interface/cli/commands/app-proxy/upgrade.cmd.js +0 -110
- package/lib/interface/cli/commands/gitops/argocd/install.js +0 -9
- package/lib/interface/cli/commands/gitops/argocd/uninstall.js +0 -11
- package/lib/interface/cli/commands/gitops/argocd/upgrade.js +0 -9
- package/lib/interface/cli/commands/gitops/codefresh/install.js +0 -50
- package/lib/interface/cli/commands/gitops/codefresh/uninstall.js +0 -14
- package/lib/interface/cli/commands/gitops/codefresh/upgrade.js +0 -9
- package/lib/interface/cli/commands/gitops/common/install.js +0 -62
- package/lib/interface/cli/commands/gitops/common/uninstall.js +0 -39
- package/lib/interface/cli/commands/gitops/common/upgrade.js +0 -45
- package/lib/interface/cli/commands/gitops/install.cmd.js +0 -116
- package/lib/interface/cli/commands/gitops/install.spec.js +0 -77
- package/lib/interface/cli/commands/gitops/uninstall.cmd.js +0 -56
- package/lib/interface/cli/commands/gitops/upgrade.cmd.js +0 -56
- package/lib/interface/cli/commands/hybrid/InstallationPlan.js +0 -216
- package/lib/interface/cli/commands/hybrid/delete.cmd.js +0 -341
- package/lib/interface/cli/commands/hybrid/init.cmd.js +0 -957
- package/lib/interface/cli/commands/hybrid/installation-process.js +0 -51
- package/lib/interface/cli/commands/hybrid/key-helper.js +0 -82
- package/lib/interface/cli/commands/hybrid/migration.js +0 -192
- package/lib/interface/cli/commands/hybrid/pipeline-helper.js +0 -71
- package/lib/interface/cli/commands/hybrid/upgrade.cmd.js +0 -195
- package/lib/interface/cli/commands/monitor/install.cmd.js +0 -160
- package/lib/interface/cli/commands/monitor/uninstall.cmd.js +0 -78
- package/lib/interface/cli/commands/root/uninstall.cmd.js +0 -17
- package/lib/interface/cli/commands/runtimeEnvironments/create.cmd.js +0 -23
- package/lib/interface/cli/commands/runtimeEnvironments/uninstall.cmd.js +0 -149
- package/lib/interface/cli/helpers/progressEvents.js +0 -25
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const Command = require('../../Command');
|
|
3
|
-
const installRoot = require('../root/install.cmd');
|
|
4
|
-
const { DefaultLogFormatter } = require('./../hybrid/helper');
|
|
5
|
-
const { downloadVeonona } = require('../hybrid/helper');
|
|
6
|
-
const { Runner, components } = require('../../../../binary');
|
|
7
|
-
const sdk = require('../../../../logic/sdk');
|
|
8
|
-
const _ = require('lodash');
|
|
9
|
-
|
|
10
|
-
const installMonitorCmd = new Command({
|
|
11
|
-
root: false,
|
|
12
|
-
parent: installRoot,
|
|
13
|
-
command: 'monitor',
|
|
14
|
-
description: 'Install and create an cluster resources monitor on kubernetes cluster',
|
|
15
|
-
webDocs: {
|
|
16
|
-
category: 'Monitor',
|
|
17
|
-
title: 'Install',
|
|
18
|
-
weight: 100,
|
|
19
|
-
},
|
|
20
|
-
builder: yargs => yargs
|
|
21
|
-
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv
|
|
22
|
-
.option('cluster-id', {
|
|
23
|
-
describe: 'Cluster id - freestyle name',
|
|
24
|
-
})
|
|
25
|
-
.option('token', {
|
|
26
|
-
describe: 'Codefresh user token',
|
|
27
|
-
})
|
|
28
|
-
.option('kube-config-path', {
|
|
29
|
-
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
30
|
-
type: 'string',
|
|
31
|
-
})
|
|
32
|
-
.option('kube-context-name', {
|
|
33
|
-
describe: 'Name of the kubernetes context on which monitor should be installed [$CF_ARG_KUBE_CONTEXT_NAME]',
|
|
34
|
-
})
|
|
35
|
-
.option('url', {
|
|
36
|
-
describe: 'Codefresh url, by default https://g.codefresh.io',
|
|
37
|
-
})
|
|
38
|
-
.option('kube-namespace', {
|
|
39
|
-
describe: 'Name of the namespace on which monitor should be installed [$CF_ARG_KUBE_NAMESPACE]',
|
|
40
|
-
})
|
|
41
|
-
.option('docker-registry', {
|
|
42
|
-
describe: 'The prefix for the container registry that will be used for pulling the required components images. Example: --docker-registry="docker.io"',
|
|
43
|
-
type: 'string',
|
|
44
|
-
})
|
|
45
|
-
.option('values', {
|
|
46
|
-
describe: 'specify values in a YAML file',
|
|
47
|
-
})
|
|
48
|
-
.option('verbose', {
|
|
49
|
-
describe: 'Print logs',
|
|
50
|
-
})
|
|
51
|
-
.option('dry-run', {
|
|
52
|
-
describe: 'dry run',
|
|
53
|
-
default: false,
|
|
54
|
-
type: 'boolean',
|
|
55
|
-
})
|
|
56
|
-
.option('bypass-download', {
|
|
57
|
-
describe: 'If the flag is set, then the first attempt (to get the required component) would be by searching for it locally. If the search fails, there will be a download attempt',
|
|
58
|
-
default: false,
|
|
59
|
-
type: 'boolean',
|
|
60
|
-
}),
|
|
61
|
-
handler: async (argv) => {
|
|
62
|
-
const {
|
|
63
|
-
url,
|
|
64
|
-
// 'kube-config-path': kubeConfigPath,
|
|
65
|
-
'cluster-id': clusterId,
|
|
66
|
-
token,
|
|
67
|
-
'kube-config-path': kubeConfigPath,
|
|
68
|
-
'kube-context-name': kubeContextName,
|
|
69
|
-
'kube-namespace': kubeNamespace,
|
|
70
|
-
'docker-registry': dockerRegistry,
|
|
71
|
-
verbose,
|
|
72
|
-
values: valuesFile,
|
|
73
|
-
'env-vars': envVars,
|
|
74
|
-
'set-value': setValue,
|
|
75
|
-
'set-file': setFile,
|
|
76
|
-
'dry-run': dryRun,
|
|
77
|
-
'bypass-download': bypassDownload,
|
|
78
|
-
// noExit,
|
|
79
|
-
} = argv;
|
|
80
|
-
const binLocation = await downloadVeonona(undefined, bypassDownload);
|
|
81
|
-
const componentRunner = new Runner(binLocation);
|
|
82
|
-
|
|
83
|
-
const commands = [
|
|
84
|
-
'install',
|
|
85
|
-
'monitor',
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
if (clusterId) {
|
|
89
|
-
commands.push('--clusterId');
|
|
90
|
-
commands.push(clusterId);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
commands.push('--codefreshToken');
|
|
94
|
-
if (token) {
|
|
95
|
-
commands.push(token);
|
|
96
|
-
} else {
|
|
97
|
-
commands.push(_.get(sdk, 'config.context.token'));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (kubeConfigPath) {
|
|
101
|
-
commands.push('--kube-config-path');
|
|
102
|
-
commands.push(kubeConfigPath);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (kubeContextName) {
|
|
106
|
-
commands.push('--kube-context-name');
|
|
107
|
-
commands.push(kubeContextName);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// if (helm3) {
|
|
111
|
-
// commands.push('--helm3');
|
|
112
|
-
// }
|
|
113
|
-
|
|
114
|
-
if (kubeNamespace) {
|
|
115
|
-
commands.push('--kube-namespace');
|
|
116
|
-
commands.push(kubeNamespace);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (url) {
|
|
120
|
-
commands.push('--codefreshHost');
|
|
121
|
-
commands.push(url);
|
|
122
|
-
}
|
|
123
|
-
if (verbose) {
|
|
124
|
-
commands.push('--verbose');
|
|
125
|
-
}
|
|
126
|
-
if (DefaultLogFormatter) {
|
|
127
|
-
commands.push(`--log-formtter=${DefaultLogFormatter}`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (dockerRegistry) {
|
|
131
|
-
commands.push(`--docker-registry=${dockerRegistry}`);
|
|
132
|
-
}
|
|
133
|
-
if (valuesFile) {
|
|
134
|
-
commands.push(`--values=${valuesFile}`);
|
|
135
|
-
}
|
|
136
|
-
if (setFile) {
|
|
137
|
-
commands.push(`--set-file=${setFile}`);
|
|
138
|
-
}
|
|
139
|
-
if (setValue) {
|
|
140
|
-
if (_.isArray(setValue)) {
|
|
141
|
-
setValue.forEach(sv => commands.push(`--set-value=${sv}`));
|
|
142
|
-
} else {
|
|
143
|
-
commands.push(`--set-value=${setValue}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (envVars) {
|
|
147
|
-
envVars.forEach((item) => {
|
|
148
|
-
const parts = item.split('=');
|
|
149
|
-
commands.push(`--set-value=EnvVars.${parts[0]}=${parts[1].replace(/,/g, '\\,')}`);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
if (dryRun) {
|
|
153
|
-
commands.push('--dry-run');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
await componentRunner.run(components.venona, commands);
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
module.exports = installMonitorCmd;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const Command = require('../../Command');
|
|
3
|
-
const unInstallRoot = require('../root/uninstall.cmd');
|
|
4
|
-
const { sdk } = require('../../../../logic');
|
|
5
|
-
const ProgressEvents = require('../../helpers/progressEvents');
|
|
6
|
-
const cliProgress = require('cli-progress');
|
|
7
|
-
const { DefaultLogFormatter } = require('./../hybrid/helper');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const unInstallAgentCmd = new Command({
|
|
11
|
-
root: false,
|
|
12
|
-
parent: unInstallRoot,
|
|
13
|
-
command: 'monitor',
|
|
14
|
-
description: 'Uninstall an monitor on kubernetes cluster',
|
|
15
|
-
webDocs: {
|
|
16
|
-
category: 'Monitor',
|
|
17
|
-
title: 'Uninstall',
|
|
18
|
-
weight: 100,
|
|
19
|
-
},
|
|
20
|
-
builder: yargs => yargs
|
|
21
|
-
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv
|
|
22
|
-
.option('kube-context-name', {
|
|
23
|
-
describe: 'Name of the kubernetes context on which monitor should be uninstalled [$CF_ARG_KUBE_CONTEXT_NAME]',
|
|
24
|
-
})
|
|
25
|
-
.option('kube-namespace', {
|
|
26
|
-
describe: 'Name of the namespace on which monitor should be uninstalled [$CF_ARG_KUBE_NAMESPACE]',
|
|
27
|
-
})
|
|
28
|
-
.option('kube-config-path', {
|
|
29
|
-
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
30
|
-
})
|
|
31
|
-
.option('verbose', {
|
|
32
|
-
describe: 'Print logs',
|
|
33
|
-
}),
|
|
34
|
-
handler: async (argv) => {
|
|
35
|
-
const {
|
|
36
|
-
'kube-namespace': kubeNamespace,
|
|
37
|
-
'kube-config-path': kubeConfigPath,
|
|
38
|
-
'kube-context-name': kubeContextName,
|
|
39
|
-
noExit,
|
|
40
|
-
} = argv;
|
|
41
|
-
|
|
42
|
-
const events = new ProgressEvents();
|
|
43
|
-
const format = 'downloading [{bar}] {percentage}% | {value}/{total}';
|
|
44
|
-
const progressBar = new cliProgress.SingleBar({ stopOnComplete: true, format }, cliProgress.Presets.shades_classic);
|
|
45
|
-
let totalSize;
|
|
46
|
-
events.onStart((size) => {
|
|
47
|
-
progressBar.start(size, 0);
|
|
48
|
-
totalSize = size;
|
|
49
|
-
});
|
|
50
|
-
events.onProgress((progress) => {
|
|
51
|
-
progressBar.update(progress);
|
|
52
|
-
if (progress >= totalSize) {
|
|
53
|
-
console.log('\n');
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const exitCode = await sdk.monitor.unInstall({
|
|
59
|
-
kubeContextName,
|
|
60
|
-
kubeNamespace,
|
|
61
|
-
kubeConfigPath,
|
|
62
|
-
terminateProcess: false,
|
|
63
|
-
events,
|
|
64
|
-
logFormatting: DefaultLogFormatter,
|
|
65
|
-
});
|
|
66
|
-
if (exitCode === 0) {
|
|
67
|
-
console.log('Monitor uninstalled successfully');
|
|
68
|
-
if (!noExit) {
|
|
69
|
-
process.exit(0);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!noExit) {
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
module.exports = unInstallAgentCmd;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const Command = require('../../Command');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const unInstall = new Command({
|
|
5
|
-
root: true,
|
|
6
|
-
command: 'uninstall',
|
|
7
|
-
description: 'Uninstall a resource',
|
|
8
|
-
usage: 'Uninstall operation will uninstall codefresh components on kubernetes cluster',
|
|
9
|
-
webDocs: {
|
|
10
|
-
description: 'Uninstall a resource',
|
|
11
|
-
category: 'Uninstall Resources',
|
|
12
|
-
title: 'Uninstall',
|
|
13
|
-
weight: 40,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
module.exports = unInstall;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const Command = require('../../Command');
|
|
2
|
-
const createRoot = require('../root/create.cmd');
|
|
3
|
-
|
|
4
|
-
const DEPRECATION_MESSAGE = 'Create runtime-environment command has been deprecated.\nUse codefresh install runtime command instead';
|
|
5
|
-
|
|
6
|
-
const command = new Command({
|
|
7
|
-
command: 'runtime-environments [cluster]',
|
|
8
|
-
aliases: ['re', 'runtime-environment'],
|
|
9
|
-
parent: createRoot,
|
|
10
|
-
description: 'Create a runtime environment',
|
|
11
|
-
webDocs: {
|
|
12
|
-
category: 'Runtime-Environments',
|
|
13
|
-
title: 'Create Runtime-Environments',
|
|
14
|
-
weight: 100,
|
|
15
|
-
},
|
|
16
|
-
handler: async () => {
|
|
17
|
-
console.log(`${DEPRECATION_MESSAGE}`);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
module.exports = command;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const Command = require('../../Command');
|
|
3
|
-
const unInstallRoot = require('../root/uninstall.cmd');
|
|
4
|
-
const { sdk } = require('../../../../logic');
|
|
5
|
-
const { getKubeContext } = require('../../helpers/kubernetes');
|
|
6
|
-
const _ = require('lodash');
|
|
7
|
-
const ProgressEvents = require('../../helpers/progressEvents');
|
|
8
|
-
const cliProgress = require('cli-progress');
|
|
9
|
-
const { DefaultLogFormatter } = require('./../hybrid/helper');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const detachRuntimeFromAgent = async (agent, runtimeName) => {
|
|
13
|
-
const { runtimes } = agent;
|
|
14
|
-
const runtimeIdx = runtimes.findIndex(re => re === runtimeName);
|
|
15
|
-
runtimes.splice(runtimeIdx, 1);
|
|
16
|
-
await sdk.agents.update({ agentId: agent.id, runtimes });
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const unInstallRuntimeCmd = new Command({
|
|
20
|
-
root: false,
|
|
21
|
-
parent: unInstallRoot,
|
|
22
|
-
command: 'runtime',
|
|
23
|
-
description: 'Uninstall a runtime on kubernetes cluster',
|
|
24
|
-
webDocs: {
|
|
25
|
-
category: 'Runtime-Environments',
|
|
26
|
-
title: 'Uninstall Runtime-Environment',
|
|
27
|
-
weight: 100,
|
|
28
|
-
},
|
|
29
|
-
builder: yargs => yargs
|
|
30
|
-
.env('CF_ARG_') // this means that every process.env.CF_ARG_* will be passed to argv
|
|
31
|
-
.option('agent-name', {
|
|
32
|
-
describe: 'Agent\'s name to be uninstalled',
|
|
33
|
-
})
|
|
34
|
-
.option('name', {
|
|
35
|
-
describe: 'Runtime\'s name to be uninstalled',
|
|
36
|
-
})
|
|
37
|
-
.option('agent-id', {
|
|
38
|
-
describe: 'Agent\'s ID',
|
|
39
|
-
})
|
|
40
|
-
.option('runtime-kube-context-name', {
|
|
41
|
-
describe: 'Name of the kubernetes context on which venona should be uninstalled [$CF_ARG_KUBE_CONTEXT_NAME]',
|
|
42
|
-
})
|
|
43
|
-
.option('runtime-kube-namespace', {
|
|
44
|
-
describe: 'Name of the namespace on which venona should be uninstalled [$CF_ARG_KUBE_NAMESPACE]',
|
|
45
|
-
})
|
|
46
|
-
.option('runtime-kube-config-path', {
|
|
47
|
-
describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
|
|
48
|
-
})
|
|
49
|
-
.option('agent-kube-context-name', {
|
|
50
|
-
describe: 'Agent kubernetes context',
|
|
51
|
-
})
|
|
52
|
-
.option('agent-kube-namespace', {
|
|
53
|
-
describe: 'Agent\'s namespace',
|
|
54
|
-
})
|
|
55
|
-
.option('agent-kube-config-path', {
|
|
56
|
-
describe: 'Path to kubeconfig file for the agent (default is $HOME/.kube/config)',
|
|
57
|
-
})
|
|
58
|
-
.option('verbose', {
|
|
59
|
-
describe: 'Print logs',
|
|
60
|
-
}),
|
|
61
|
-
handler: async (argv) => {
|
|
62
|
-
const {
|
|
63
|
-
'agent-name': agentName,
|
|
64
|
-
'agent-id': agentId,
|
|
65
|
-
name: runtimeName,
|
|
66
|
-
'runtime-kube-namespace': kubeNamespace,
|
|
67
|
-
'runtime-kube-config-path': kubeConfigPath,
|
|
68
|
-
'restart-agent': restartAgent,
|
|
69
|
-
'agent-kube-config-path': agentKubeConfigPath,
|
|
70
|
-
verbose,
|
|
71
|
-
terminateProcess,
|
|
72
|
-
|
|
73
|
-
} = argv;
|
|
74
|
-
|
|
75
|
-
let {
|
|
76
|
-
'runtime-kube-context-name': kubeContextName,
|
|
77
|
-
'agent-kube-context-name': agentKubeContextName,
|
|
78
|
-
'agent-kube-namespace': agentKubeNamespace,
|
|
79
|
-
} = argv;
|
|
80
|
-
|
|
81
|
-
if (!kubeContextName) {
|
|
82
|
-
kubeContextName = getKubeContext(kubeConfigPath);
|
|
83
|
-
}
|
|
84
|
-
if (!agentKubeContextName) {
|
|
85
|
-
agentKubeContextName = getKubeContext(agentKubeConfigPath);
|
|
86
|
-
}
|
|
87
|
-
if (!agentKubeNamespace) {
|
|
88
|
-
agentKubeNamespace = kubeNamespace;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
let agent;
|
|
92
|
-
if (_.isNull(runtimeName) || _.isUndefined(runtimeName) || runtimeName === '') {
|
|
93
|
-
throw new Error('runtime name is mandatory');
|
|
94
|
-
}
|
|
95
|
-
if (agentName) {
|
|
96
|
-
agent = await sdk.agents.getByName({ name: agentName });
|
|
97
|
-
} else if (agentId) {
|
|
98
|
-
agent = await sdk.agents.get({ agentId });
|
|
99
|
-
} else {
|
|
100
|
-
throw new Error('agent name or agent id is needed');
|
|
101
|
-
}
|
|
102
|
-
if (agent === '' || !agent) {
|
|
103
|
-
throw new Error('agent was not found');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const runtimes = _.get(agent, 'runtimes', []);
|
|
107
|
-
if (!_.find(runtimes, value => value === runtimeName)) {
|
|
108
|
-
throw new Error(`Runtime ${runtimeName} is not attached to agent ${agent.name}`);
|
|
109
|
-
}
|
|
110
|
-
const runtimeIns = await sdk.runtimeEnvs.get({ name: runtimeName });
|
|
111
|
-
const storageClassName = _.get(runtimeIns, 'RuntimeScheduler.Pvcs.Dind.StorageClassName');
|
|
112
|
-
await detachRuntimeFromAgent(agent, runtimeName);
|
|
113
|
-
|
|
114
|
-
// Get agent
|
|
115
|
-
|
|
116
|
-
const events = new ProgressEvents();
|
|
117
|
-
const format = 'downloading [{bar}] {percentage}% | {value}/{total}';
|
|
118
|
-
const progressBar = new cliProgress.SingleBar({ stopOnComplete: true, format }, cliProgress.Presets.shades_classic);
|
|
119
|
-
let totalSize;
|
|
120
|
-
events.onStart((size) => {
|
|
121
|
-
progressBar.start(size, 0);
|
|
122
|
-
totalSize = size;
|
|
123
|
-
});
|
|
124
|
-
events.onProgress((progress) => {
|
|
125
|
-
progressBar.update(progress);
|
|
126
|
-
if (progress >= totalSize) {
|
|
127
|
-
console.log('\n');
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
await sdk.runtime.unInstall({
|
|
132
|
-
runtimeName,
|
|
133
|
-
kubeContextName,
|
|
134
|
-
kubeNamespace,
|
|
135
|
-
kubeConfigPath,
|
|
136
|
-
agentKubeContextName,
|
|
137
|
-
agentKubeNamespace,
|
|
138
|
-
agentKubeConfigPath,
|
|
139
|
-
restartAgent,
|
|
140
|
-
storageClassName,
|
|
141
|
-
verbose,
|
|
142
|
-
terminateProcess: (terminateProcess !== false),
|
|
143
|
-
events,
|
|
144
|
-
logFormatting: DefaultLogFormatter,
|
|
145
|
-
});
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
module.exports = unInstallRuntimeCmd;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const EventEmitter = require('events');
|
|
2
|
-
|
|
3
|
-
class ProgressEvents {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.emitter = new EventEmitter();
|
|
6
|
-
}
|
|
7
|
-
onStart(handler) {
|
|
8
|
-
this.emitter.addListener('start', (args) => {
|
|
9
|
-
handler(args);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
onProgress(handler) {
|
|
13
|
-
this.emitter.addListener('progress', (args) => {
|
|
14
|
-
handler(args);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
reportStart(args) {
|
|
18
|
-
this.emitter.emit('start', args);
|
|
19
|
-
}
|
|
20
|
-
reportProgress(args) {
|
|
21
|
-
this.emitter.emit('progress', args);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = ProgressEvents;
|