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.
Files changed (42) hide show
  1. package/lib/binary/components.js +0 -57
  2. package/lib/interface/cli/commands/agent/install.cmd.js +6 -126
  3. package/lib/interface/cli/commands/components/download.cmd.js +1 -1
  4. package/lib/interface/cli/commands/hybrid/execute-test-pipeline.cmd.js +37 -11
  5. package/lib/interface/cli/commands/hybrid/helper.js +8 -896
  6. package/lib/interface/cli/commands/runtimeEnvironments/attach.cmd.js +3 -103
  7. package/lib/interface/cli/commands/runtimeEnvironments/install.cmd.js +8 -134
  8. package/lib/interface/cli/completion/tree.json +1 -1
  9. package/lib/interface/cli/helpers/kubernetes.js +8 -42
  10. package/package.json +3 -22
  11. package/lib/interface/cli/commands/agent/uninstall.cmd.js +0 -92
  12. package/lib/interface/cli/commands/app-proxy/helper.js +0 -63
  13. package/lib/interface/cli/commands/app-proxy/install.cmd.js +0 -204
  14. package/lib/interface/cli/commands/app-proxy/uninstall.cmd.js +0 -175
  15. package/lib/interface/cli/commands/app-proxy/upgrade.cmd.js +0 -110
  16. package/lib/interface/cli/commands/gitops/argocd/install.js +0 -9
  17. package/lib/interface/cli/commands/gitops/argocd/uninstall.js +0 -11
  18. package/lib/interface/cli/commands/gitops/argocd/upgrade.js +0 -9
  19. package/lib/interface/cli/commands/gitops/codefresh/install.js +0 -50
  20. package/lib/interface/cli/commands/gitops/codefresh/uninstall.js +0 -14
  21. package/lib/interface/cli/commands/gitops/codefresh/upgrade.js +0 -9
  22. package/lib/interface/cli/commands/gitops/common/install.js +0 -62
  23. package/lib/interface/cli/commands/gitops/common/uninstall.js +0 -39
  24. package/lib/interface/cli/commands/gitops/common/upgrade.js +0 -45
  25. package/lib/interface/cli/commands/gitops/install.cmd.js +0 -116
  26. package/lib/interface/cli/commands/gitops/install.spec.js +0 -77
  27. package/lib/interface/cli/commands/gitops/uninstall.cmd.js +0 -56
  28. package/lib/interface/cli/commands/gitops/upgrade.cmd.js +0 -56
  29. package/lib/interface/cli/commands/hybrid/InstallationPlan.js +0 -216
  30. package/lib/interface/cli/commands/hybrid/delete.cmd.js +0 -341
  31. package/lib/interface/cli/commands/hybrid/init.cmd.js +0 -957
  32. package/lib/interface/cli/commands/hybrid/installation-process.js +0 -51
  33. package/lib/interface/cli/commands/hybrid/key-helper.js +0 -82
  34. package/lib/interface/cli/commands/hybrid/migration.js +0 -192
  35. package/lib/interface/cli/commands/hybrid/pipeline-helper.js +0 -71
  36. package/lib/interface/cli/commands/hybrid/upgrade.cmd.js +0 -195
  37. package/lib/interface/cli/commands/monitor/install.cmd.js +0 -160
  38. package/lib/interface/cli/commands/monitor/uninstall.cmd.js +0 -78
  39. package/lib/interface/cli/commands/root/uninstall.cmd.js +0 -17
  40. package/lib/interface/cli/commands/runtimeEnvironments/create.cmd.js +0 -23
  41. package/lib/interface/cli/commands/runtimeEnvironments/uninstall.cmd.js +0 -149
  42. package/lib/interface/cli/helpers/progressEvents.js +0 -25
@@ -18,61 +18,4 @@ module.exports = {
18
18
  repo: 'Stevedore',
19
19
  },
20
20
  },
21
- venona: {
22
- name: 'venona',
23
- description: 'Install required assets on Kubernetes cluster',
24
- version: {
25
- prefix: '',
26
- },
27
- local: {
28
- versionFile: 'version.txt',
29
- dir: 'agent',
30
- binary: 'venona',
31
- alternateBinary: process.env.VENONACTL,
32
- },
33
- remote: {
34
- versionPath: 'venonactl',
35
- versionFile: 'VERSION',
36
- branch: 'release-1.0',
37
- repo: 'venona',
38
- },
39
- },
40
- gitops: {
41
- 'argocd-agent': {
42
- name: 'gitops',
43
- description: 'Install gitops argocd agent',
44
- version: {
45
- prefix: '',
46
- },
47
- local: {
48
- versionFile: 'version.txt',
49
- dir: 'gitops',
50
- binary: 'argocd-agent',
51
- },
52
- remote: {
53
- versionPath: 'installer',
54
- versionFile: 'VERSION',
55
- branch: 'master',
56
- repo: 'argocd-agent',
57
- },
58
- },
59
- codefresh: {
60
- name: 'cf-gitops-controller',
61
- description: 'Install gitops codefresh controller',
62
- version: {
63
- prefix: '',
64
- },
65
- local: {
66
- versionFile: 'version.txt',
67
- dir: 'cf-gitops-controller',
68
- binary: 'cf-gitops-controller',
69
- },
70
- remote: {
71
- versionPath: '/',
72
- versionFile: 'VERSION',
73
- branch: 'main',
74
- repo: 'cf-gitops-controller',
75
- },
76
- },
77
- },
78
21
  };
@@ -1,14 +1,11 @@
1
1
  /* eslint-disable max-len */
2
- const cliProgress = require('cli-progress');
3
2
  const colors = require('colors');
4
3
  const Command = require('../../Command');
5
4
  const installRoot = require('../root/install.cmd');
6
5
  const { sdk } = require('../../../../logic');
7
6
  const installRuntimeCmd = require('../runtimeEnvironments/install.cmd');
8
7
  const { getKubeContext } = require('../../helpers/kubernetes');
9
- const ProgressEvents = require('../../helpers/progressEvents');
10
8
  const { getNewAgentName } = require('./helper');
11
- const { DefaultLogFormatter } = require('../hybrid/helper');
12
9
  const Output = require('../../../../output/Output');
13
10
 
14
11
  const defaultNamespace = 'codefresh';
@@ -57,80 +54,17 @@ async function getAgentNameByToken(token) {
57
54
  return name;
58
55
  }
59
56
 
60
- async function installAgentInCluster(argv, token, agentName) {
61
- const {
62
- kubeNodeSelector,
63
- dryRun,
64
- inCluster,
65
- tolerations,
66
- dockerRegistry,
67
- skipVersionCheck,
68
- kubeConfigPath,
69
- kubeContextName = getKubeContext(kubeConfigPath),
70
- kubeNamespace = defaultNamespace,
71
- envVars,
72
- verbose,
73
- terminateProcess,
74
- } = argv;
75
-
76
- const apiHost = sdk.config.context.url;
77
- const events = new ProgressEvents();
78
- const format = 'downloading [{bar}] {percentage}% | {value}/{total}';
79
- const progressBar = new cliProgress.SingleBar({ stopOnComplete: true, format }, cliProgress.Presets.shades_classic);
80
- let totalSize;
81
- events.onStart((size) => {
82
- console.log('Downloading Codefresh Runner installer \n');
83
- progressBar.start(size, 0);
84
- totalSize = size;
85
- });
86
- events.onProgress((progress) => {
87
- progressBar.update(progress);
88
- if (progress >= totalSize) {
89
- console.log('\n');
90
- }
91
- });
92
- const agentInstallStatusCode = await sdk.agents.install({
93
- agentId: agentName,
94
- apiHost,
95
- token,
96
- kubeConfigPath,
97
- kubeContextName,
98
- kubeNamespace,
99
- kubeNodeSelector,
100
- inCluster,
101
- dockerRegistry,
102
- tolerations,
103
- skipVersionCheck,
104
- envVars,
105
- events,
106
- dryRun,
107
- verbose,
108
- terminateProcess,
109
- logFormatting: DefaultLogFormatter,
110
- });
111
- if (agentInstallStatusCode !== 0) {
112
- throw new Error(`\nRunner installation failed with code ${agentInstallStatusCode}`);
113
- }
114
- }
115
-
116
57
  async function installRuntimeFunc(argv, agentName) {
117
58
  const {
118
59
  runtimeName,
119
60
  skipReCreation,
120
61
  buildNodeSelector,
121
62
  storageClassName,
122
- setValue,
123
- setFile,
124
- agentKubeContextName,
125
- agentKubeNamespace,
126
63
  kubeConfigPath,
127
64
  kubeContextName,
128
65
  kubeNamespace,
129
66
  skipClusterCreation,
130
67
  makeDefaultRuntime,
131
- platformOnly,
132
- verbose,
133
- terminateProcess,
134
68
  } = argv;
135
69
  await installRuntimeCmd.handler({
136
70
  runtimeName,
@@ -141,17 +75,9 @@ async function installRuntimeFunc(argv, agentName) {
141
75
  runtimeKubeNamespace: kubeNamespace,
142
76
  kubeNodeSelector: buildNodeSelector,
143
77
  storageClassName,
144
- setValue,
145
- setFile,
146
78
  makeDefaultRuntime,
147
79
  attachRuntime: true,
148
80
  agentName,
149
- agentKubeContextName,
150
- agentKubeNamespace,
151
- restartAgent: true,
152
- platformOnly,
153
- verbose,
154
- terminateProcess,
155
81
  });
156
82
  }
157
83
 
@@ -159,7 +85,7 @@ const installAgentCmd = new Command({
159
85
  root: false,
160
86
  parent: installRoot,
161
87
  command: 'agent',
162
- description: 'Install and create an agent on kubernetes cluster',
88
+ description: 'Create an agent in the Codefresh platform',
163
89
  webDocs: {
164
90
  category: 'Agents',
165
91
  title: 'Install',
@@ -174,31 +100,16 @@ const installAgentCmd = new Command({
174
100
  describe: 'Agent\'s token',
175
101
  })
176
102
  .option('kube-context-name', {
177
- describe: 'Name of the kubernetes context on which runner should be installed [$CF_ARG_KUBE_CONTEXT_NAME]',
178
- })
179
- .option('kube-node-selector', {
180
- describe: 'The kubernetes node selector "key=value" to be used by runner build resources (default is no node selector) (string)',
181
- })
182
- .option('dry-run', {
183
- describe: 'Set to true to simulate installation',
184
- })
185
- .option('in-cluster', {
186
- describe: 'Set flag if runner is been installed from inside a cluster',
103
+ describe: 'Name of the kubernetes context where the runner is installed [$CF_ARG_KUBE_CONTEXT_NAME]',
187
104
  })
188
105
  .option('kube-namespace', {
189
- describe: 'Name of the namespace on which runner should be installed [$CF_ARG_KUBE_NAMESPACE]',
190
- })
191
- .option('tolerations', {
192
- describe: 'The kubernetes tolerations as path to a JSON file to be used by runner resources (default is no tolerations) (string)',
106
+ describe: 'Name of the namespace where the runner is installed [$CF_ARG_KUBE_NAMESPACE]',
193
107
  })
194
108
  .option('kube-config-path', {
195
109
  describe: 'Path to kubeconfig file (default is $HOME/.kube/config)',
196
110
  })
197
- .option('skip-version-check', {
198
- describe: 'Do not compare current runner\'s version with latest',
199
- })
200
111
  .option('install-runtime', {
201
- describe: 'Install and attach runtime on the same namespace as the agent (default is false)',
112
+ describe: 'Create runtime and attach it to the agent (default is false)',
202
113
  })
203
114
  .option('runtime-name', {
204
115
  describe: 'The name of the runtime to install',
@@ -209,12 +120,6 @@ const installAgentCmd = new Command({
209
120
  .option('skip-re-creation', {
210
121
  description: 'If set to true, will skip runtime creation in the platform',
211
122
  })
212
- .option('set-value', {
213
- describe: 'Set values for templates, example: --set-value LocalVolumesDir=/mnt/disks/ssd0/codefresh-volumes',
214
- })
215
- .option('set-file', {
216
- describe: 'Set values for templates from file, example: --set-file Storage.GoogleServiceAccount=/path/to/service-account.json',
217
- })
218
123
  .option('skip-cluster-creation', {
219
124
  description: 'If set to true, will skip cluster integration creation for this runtime',
220
125
  })
@@ -224,37 +129,16 @@ const installAgentCmd = new Command({
224
129
  .option('storage-class-name', {
225
130
  describe: 'Set a name of your custom storage class, note: this will not install volume provisioning components',
226
131
  })
227
- .option('agent-kube-context-name', {
228
- describe: 'Agent kubernetes context (on attach)',
229
- })
230
- .option('agent-kube-namespace', {
231
- describe: 'Agent\'s namespace (on attach)',
232
- })
233
- .option('docker-registry', {
234
- describe: 'The prefix for the container registry that will be used for pulling the required components images. Example: --docker-registry="docker.io"',
235
- type: 'string',
236
- })
237
132
  .option('platform-only', {
238
- describe: 'Set to true to create runtime on the platform side only',
239
- })
240
- .option('verbose', {
241
- describe: 'Print logs',
133
+ describe: 'Deprecated, has no effect: agent and runtime are always created on the platform side only',
242
134
  }),
243
135
  handler: async (argv) => {
244
- const {
245
- agentKubeNamespace,
246
- installRuntime,
247
- platformOnly,
248
- } = argv;
136
+ const { installRuntime } = argv;
249
137
  let {
250
138
  name,
251
139
  token,
252
140
  } = argv;
253
141
 
254
- if (installRuntimeFunc && !agentKubeNamespace) {
255
- throw new Error('agent-kube-namespace is a mandatory parameter when installing runtime');
256
- }
257
-
258
142
  if (!token) {
259
143
  // Create an agent if not provided
260
144
  token = await createAgent(argv);
@@ -268,10 +152,6 @@ const installAgentCmd = new Command({
268
152
  }
269
153
  }
270
154
 
271
- if (!platformOnly) {
272
- await installAgentInCluster(argv, token, name);
273
- }
274
-
275
155
  if (installRuntime) {
276
156
  await installRuntimeFunc(argv, name);
277
157
  }
@@ -16,7 +16,7 @@ const command = new Command({
16
16
  describe: 'Override download folder location. Default: ~/.Codefresh',
17
17
  })
18
18
  .option('components', {
19
- describe: 'Components. List of [stevedore, venona, argocd-agent, codefresh]',
19
+ describe: 'Components. List of [stevedore]',
20
20
  }),
21
21
  handler: async (argv) => {
22
22
  console.log('Downloading components');
@@ -1,11 +1,17 @@
1
+ const colors = require('colors');
1
2
  const Command = require('../../Command');
2
3
  const runnerRoot = require('../root/runner.cmd');
3
- const colors = require('colors');
4
- const InstallationPlan = require('./InstallationPlan');
5
- const { addPipelineToInstallationPlan } = require('./pipeline-helper');
6
- const { createErrorHandler } = require('./helper');
4
+ const { to } = require('../../../../logic/cli-config/errors/awaitTo');
5
+ const {
6
+ createErrorHandler,
7
+ createTestPipeline,
8
+ getTestPipeline,
9
+ updateTestPipelineRuntime,
10
+ executeTestPipeline,
11
+ INSTALLATION_DEFAULTS,
12
+ } = require('./helper');
7
13
 
8
- const handleError = createErrorHandler(`\nIf you had any issues with the installation please report them at:\
14
+ const handleError = createErrorHandler(`\nIf you had any issues with the test pipeline please report them at:\
9
15
  ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`);
10
16
 
11
17
  const defaultDockerRegistry = 'quay.io';
@@ -19,17 +25,37 @@ const command = new Command({
19
25
  category: 'Runner',
20
26
  title: 'Execute test pipeline',
21
27
  },
22
- builder: yargs => yargs
28
+ builder: (yargs) => yargs
23
29
  .option('runtime-name', {
24
30
  describe: 'Runtime name to execute pipeline on',
25
31
  }),
26
32
  handler: async (argv) => {
27
- const { runtimeName } = argv;
33
+ const runtimeName = argv.runtimeName ? argv.runtimeName.trim() : argv.runtimeName;
34
+ const pipelineName = INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME;
35
+
36
+ const [getErr, pipeline] = await to(getTestPipeline(pipelineName));
37
+ handleError(getErr, 'Failed to get test pipeline');
38
+
39
+ if (!pipeline) {
40
+ const [createErr] = await to(createTestPipeline(
41
+ runtimeName,
42
+ pipelineName,
43
+ ['echo hello Codefresh Runner!'],
44
+ defaultDockerRegistry,
45
+ ));
46
+ handleError(createErr, 'Failed to create test pipeline');
47
+ } else {
48
+ const [updateErr] = await to(updateTestPipelineRuntime(pipeline, runtimeName, pipelineName, defaultDockerRegistry));
49
+ if (updateErr) {
50
+ handleError(updateErr, colors.yellow('*warning* could not update test pipeline runtime, you can'
51
+ + ' change it manually if you want to run it again on this runtime'), false);
52
+ } else {
53
+ console.log('Updated test pipeline runtime');
54
+ }
55
+ }
28
56
 
29
- const installationPlan = new InstallationPlan({ errHandler: handleError });
30
- installationPlan.addContext('runtimeName', runtimeName ? runtimeName.trim() : runtimeName);
31
- await addPipelineToInstallationPlan(installationPlan, defaultDockerRegistry, true);
32
- await installationPlan.execute();
57
+ const [execErr] = await to(executeTestPipeline(runtimeName, pipelineName));
58
+ handleError(execErr, 'Failed to execute test pipeline');
33
59
  process.exit(); // TODO : This is not needed - needed to be fixed
34
60
  },
35
61
  });