Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,12 @@ const initCmd = new Command({
installationPlan.addStep({
name: 'create new runtime',
func: async () => {
const reName = installationPlan.getContext('runtimeName');
const runtimeCreateOpt = {
namespace: kubeNamespace,
storageClassName: storageClassName || `${INSTALLATION_DEFAULTS.STORAGE_CLASS_PREFIX}-${kubeNamespace}`,
clusterName: kubeContextName,
runtimeEnvironmentName: installationPlan.getContext('runtimeName'),
runtimeEnvironmentName: reName,
agent: true,
};

Expand All @@ -381,6 +382,7 @@ const initCmd = new Command({
}

await sdk.cluster.create(runtimeCreateOpt);
console.log(`Runtime environment "${colors.cyan(reName)}" has been created`);
},
});

Expand Down
11 changes: 11 additions & 0 deletions lib/interface/cli/helpers/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const CFError = require('cf-errors');
const { sdk } = require('../../../logic');
const Workflow = require('../../../logic/entities/Workflow');
const Output = require('../../../output/Output');
const checkVersion = require('./../../../../check-version');

const nodeVersionToValidate = '<=10.x >=8.x';

const END_STATUSES = ['error', 'success', 'terminated'];

Expand Down Expand Up @@ -53,6 +56,14 @@ async function _fallbackLogs(workflowId, interval, retriesLeft) {
}

const followLogs = async (workflowId) => {
try {
checkVersion(nodeVersionToValidate);
} catch (error) {
// eslint-disable-next-line max-len
console.log(`As your node version (${process.version}) is not compatible with supported node version (${nodeVersionToValidate}) for this command, you won't be able to see logs`);
return;
}

try {
await sdk.logs.showWorkflowLogs(workflowId, true);
} catch (e) {
Expand Down
18 changes: 9 additions & 9 deletions lib/logic/entities/Agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ class Agent extends Entity {
this.name = data.name;
this.runtimes = data.runtimes;
const status = _.get(data, 'status.healthStatus', 'N/A');
this.status = this._pickStatusColor(status)(status);
this.status = Agent._pickStatusColor(status)(status);
const lastReported = _.get(data, 'status.reportedAt', 'N/A');
this.reported = this._pickLastReportedColor(status)(lastReported);
this.reported = Agent._pickLastReportedColor(status)(lastReported);
this.defaultColumns = ['name', 'runtimes', 'status', 'reported'];
}

// eslint-disable-next-line class-methods-use-this
_pickLastReportedColor(healthStatus) {
static _pickLastReportedColor(healthStatus) {
switch (healthStatus) {
case 'N/A':
return chalk.gray;
Expand All @@ -30,19 +29,20 @@ class Agent extends Entity {
}
}

_pickStatusColor(healthStatus) {
static _pickStatusColor(healthStatus) {
switch (healthStatus) {
case 'N/A':
return chalk.white.bgGray;
return chalk.white.bgGray || _.identity;
case 'unhealthy':
return chalk.white.bgRed;
return chalk.white.bgRed || _.identity;
case 'healthy':
return chalk.black.bgGreen;
return chalk.black.bgGreen || _.identity;
default:
return chalk.black.bgRed;
return chalk.black.bgRed || _.identity;
}
}


static fromResponse(response) {
return new Agent(_.pick(response, 'id', 'name', 'runtimes', 'status', 'lastReported'));
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.69.2",
"version": "0.69.3",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down Expand Up @@ -91,7 +91,7 @@
"author": "Codefresh",
"license": "ISC",
"engines": {
"node": ">=8.0.0"
"node": ">=8.x"
},
"jest": {
"testEnvironment": "node",
Expand Down