Skip to content

Commit ea904e0

Browse files
wip (#512)
1 parent 4d348f8 commit ea904e0

File tree

7 files changed

+47
-26
lines changed

7 files changed

+47
-26
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ const installAgentCmd = new Command({
124124
agent = await sdk.agents.create({ name });
125125
// eslint-disable-next-line prefer-destructuring
126126
token = agent.token;
127-
console.log(`A Codefresh Runner with the name: ${colors.cyan(name)} has been created.\n${colors.yellow('*IMPORTANT*')} Make sure to copy your access token now and store it in a safe location. You won’t be able to see it again.`);
128-
console.log(token);
127+
console.log(`A Codefresh Runner with the name: ${colors.cyan(name)} has been created.`);
129128
} else {
130129
// take the agent id from the token
131130
const apiKey = token.split('.')[0];

lib/interface/cli/commands/hybrid/delete.cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const deleteCmd = new Command({
222222
handleError(uninstallMonitorErr, 'Failed to uninstall monitor');
223223

224224
console.log('Successfully uninstalled Codefresh Runner');
225-
console.log(colors.green(`\nIf you had any issues with the uninstallation process please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`));
225+
console.log(`\nIf you had any issues with the uninstallation process please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`);
226226
await drawCodefreshFiglet();
227227
process.exit(); // TODO : This is not needed - needed to be fixed
228228
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async function createTestPipeline(runtimeName, pipelineName, pipelineCommands) {
7575
stage: 'test',
7676
title: 'test',
7777
image: 'alpine:latest',
78-
commands: pipelineCommands || ['echo hello codefresh runner!'],
78+
commands: pipelineCommands || ['echo hello Codefresh Runner!'],
7979
};
8080

8181
await sdk.pipelines.replace(

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const initCmd = new Command({
6363
parent: runnerRoot,
6464
command: 'init',
6565
requiresAuthentication: false,
66-
description: 'Install Codefresh Runner solution\'s components on kubernetes cluster',
66+
description: 'Install Codefresh Runner solution\'s components on Kubernetes cluster',
6767
webDocs: {
6868
category: 'Runner',
6969
title: 'Init',
@@ -83,13 +83,13 @@ const initCmd = new Command({
8383
default: DEFAULTS.URL,
8484
})
8585
.option('kube-context-name', {
86-
describe: 'Name of the kubernetes context on which venona should be installed [$CF_ARG_KUBE_CONTEXT_NAME]',
86+
describe: 'Name of the Kubernetes context on which venona should be installed [$CF_ARG_KUBE_CONTEXT_NAME]',
8787
})
8888
.option('kube-node-selector', {
89-
describe: 'The kubernetes node selector "key=value" to be used by venona build resources (default is no node selector) (string)',
89+
describe: 'The Kubernetes node selector "key=value" to be used by venona build resources (default is no node selector) (string)',
9090
})
9191
.option('build-node-selector', {
92-
describe: 'The kubernetes node selector "key=value" to be used by the codefresh build resources (default is no node selector)',
92+
describe: 'The Kubernetes node selector "key=value" to be used by the Codefresh build resources (default is no node selector)',
9393
})
9494
.option('yes', {
9595
describe: 'Use installation defaults (don\'t ask any questions)',
@@ -117,7 +117,7 @@ const initCmd = new Command({
117117
describe: 'Name of the namespace on which venona should be installed [$CF_ARG_KUBE_NAMESPACE]',
118118
})
119119
.option('tolerations', {
120-
describe: 'The kubernetes tolerations as path to a JSON file to be used by venona resources (default is no tolerations) (string)',
120+
describe: 'The Kubernetes tolerations as path to a JSON file to be used by venona resources (default is no tolerations) (string)',
121121
})
122122
.option('storage-class-name', {
123123
describe: 'Set a name of your custom storage class',
@@ -329,9 +329,7 @@ const initCmd = new Command({
329329
const agent = await sdk.agents.create({ name: agentName });
330330
installationPlan.addContext('agent', agent);
331331
const { token: agentToken } = agent;
332-
console.log(`A Codefresh Runner with the name: ${colors.cyan(agentName)} has been created.` +
333-
`\n${colors.yellow('*IMPORTANT*')} Make sure to copy your access token now and st` +
334-
'ore it in a safe location. You won’t be able to see it again.');
332+
console.log(`A Codefresh Runner with the name: ${colors.cyan(agentName)} has been created.`);
335333
console.log(agentToken);
336334
installationPlan.addContext('agentToken', agentToken);
337335
},
@@ -514,7 +512,7 @@ const initCmd = new Command({
514512
await createTestPipeline(
515513
installationPlan.getContext('runtimeName'),
516514
INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME,
517-
['echo hello codefresh runner!'],
515+
['echo hello Codefresh Runner!'],
518516
);
519517
},
520518
installationEvent: installationProgress.events.PIPELINE_CREATED,
@@ -552,11 +550,13 @@ const initCmd = new Command({
552550

553551
console.log(colors.green('\nRunner Status:'));
554552
await getAgents.handler({});
553+
console.log('');
555554
if (installMonitor) {
556-
console.log(colors.green(`\nGo to ${colors.blue('https://g.codefresh.io/kubernetes/monitor/services')} to view your cluster in codefresh dashbaord`));
555+
console.log(`Go to ${colors.blue('https://g.codefresh.io/kubernetes/monitor/services')} to view your cluster in Codefresh dashbaord`);
557556
}
558-
console.log(colors.green(`\nDocumenation link: ${colors.blue('https://codefresh.io/docs/docs/enterprise/codefresh-runner/#codefresh-runner-preview-release')}`));
559-
console.log(colors.green(`If you had any issues with the installation please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`));
557+
console.log(`Link to the new runtime: ${colors.blue(`https://g.codefresh.io/account-admin/account-conf/runtime-environments?runtime=${encodeURI(installationPlan.getContext('runtimeName'))}`)}`);
558+
console.log(`\nDocumenation link: ${colors.blue('https://codefresh.io/docs/docs/enterprise/codefresh-runner/#codefresh-runner-preview-release')}`);
559+
console.log(`If you had any issues with the installation please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`);
560560
await to(progressReporter.report(installationProgress.events.FINISHED, installationProgress.status.SUCCESS));
561561
await drawCodefreshFiglet();
562562
process.exit(); // TODO : This is not needed - needed to be fixed

lib/logic/entities/Agent.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const _ = require('lodash');
22
const Entity = require('./Entity');
3-
const colors = require('colors');
3+
const chalk = require('chalk');
44

55
class Agent extends Entity {
66
constructor(data) {
@@ -9,23 +9,37 @@ class Agent extends Entity {
99
this.id = data.id;
1010
this.name = data.name;
1111
this.runtimes = data.runtimes;
12-
this.status = _.get(data, 'status.message', 'N/A');
12+
const status = _.get(data, 'status.healthStatus', 'N/A');
13+
this.status = this._pickStatusColor(status)(status);
1314
const lastReported = _.get(data, 'status.reportedAt', 'N/A');
14-
this.reported = this.pickStatusColor(_.get(data, 'status.healthStatus', 'N/A'))(lastReported);
15+
this.reported = this._pickLastReportedColor(status)(lastReported);
1516
this.defaultColumns = ['name', 'runtimes', 'status', 'reported'];
1617
}
1718

1819
// eslint-disable-next-line class-methods-use-this
19-
pickStatusColor(healthStatus) {
20+
_pickLastReportedColor(healthStatus) {
2021
switch (healthStatus) {
2122
case 'N/A':
22-
return colors.red;
23+
return chalk.gray;
2324
case 'unhealthy':
24-
return colors.yellow;
25+
return chalk.red;
2526
case 'healthy':
26-
return colors.green;
27+
return chalk.green;
2728
default:
28-
return colors.red;
29+
return chalk.red;
30+
}
31+
}
32+
33+
_pickStatusColor(healthStatus) {
34+
switch (healthStatus) {
35+
case 'N/A':
36+
return chalk.white.bgGray;
37+
case 'unhealthy':
38+
return chalk.white.bgRed;
39+
case 'healthy':
40+
return chalk.black.bgGreen;
41+
default:
42+
return chalk.black.bgRed;
2943
}
3044
}
3145

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.68.14",
3+
"version": "0.68.15",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,
@@ -35,7 +35,7 @@
3535
"ajv": "^6.6.1",
3636
"bluebird": "^3.5.1",
3737
"cf-errors": "^0.1.12",
38-
"chalk": "^1.1.3",
38+
"chalk": "^4.1.0",
3939
"cli-progress": "3.6.0",
4040
"codefresh-sdk": "^1.9.13",
4141
"colors": "^1.1.2",

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,14 @@ chalk@^3.0.0:
10661066
ansi-styles "^4.1.0"
10671067
supports-color "^7.1.0"
10681068

1069+
chalk@^4.1.0:
1070+
version "4.1.0"
1071+
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
1072+
integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==
1073+
dependencies:
1074+
ansi-styles "^4.1.0"
1075+
supports-color "^7.1.0"
1076+
10691077
changed-log@0.11.0:
10701078
version "0.11.0"
10711079
resolved "https://registry.yarnpkg.com/changed-log/-/changed-log-0.11.0.tgz#173d1878bfa28d0c8a4ff91e45545cebc8ed6447"

0 commit comments

Comments
 (0)