Skip to content

log formatting #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions lib/interface/cli/commands/agent/install.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const colors = require('colors');
const { getNewAgentName } = require('./helper');
const { DefaultLogFormatter } = require('./../hybrid/helper');

const defaultNamespace = 'codefresh';

Expand Down Expand Up @@ -177,6 +178,7 @@ const installAgentCmd = new Command({
agentId: name,
terminateProcess,
events,
logFormatting: DefaultLogFormatter,
});
if (agentInstallStatusCode !== 0) {
throw new Error(`\nRunner installation failed with code ${agentInstallStatusCode}`);
Expand Down
2 changes: 2 additions & 0 deletions lib/interface/cli/commands/agent/uninstall.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { sdk } = require('../../../../logic');
const { getKubeContext } = require('../../helpers/kubernetes');
const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const { DefaultLogFormatter } = require('./../hybrid/helper');


const unInstallAgentCmd = new Command({
Expand Down Expand Up @@ -76,6 +77,7 @@ const unInstallAgentCmd = new Command({
kubeConfigPath,
terminateProcess: false,
events,
logFormatting: DefaultLogFormatter,
});
if (exitCode === 0) {
console.log('Agent uninsalled successfully');
Expand Down
3 changes: 3 additions & 0 deletions lib/interface/cli/commands/hybrid/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const INSTALLATION_DEFAULTS = {
CF_CONTEXT_NAME: 'cf-runner',
};

const DefaultLogFormatter = 'plain';

const defaultOpenIssueMessage = 'If you had any issues with this process please report them at: ' +
`${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`;
const url = _.get(sdk, 'config.context.url', 'https://g.codefresh.io');
Expand Down Expand Up @@ -224,4 +226,5 @@ module.exports = {
createProgressBar,
getTestPipelineLink,
INSTALLATION_DEFAULTS,
DefaultLogFormatter,
};
11 changes: 10 additions & 1 deletion lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {
executeTestPipeline,
INSTALLATION_DEFAULTS,
} = require('./helper');

const figlet = require('figlet');

const handleError = createErrorHandler(`\nIf you had any issues with the installation please report them at: ${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`);

Expand Down Expand Up @@ -324,6 +324,15 @@ const initCmd = new Command({
console.log(colors.green(`\nDocumenation link: ${colors.blue('https://codefresh.io/docs/docs/enterprise/codefresh-runner/#codefresh-runner-preview-release')}`));
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')}`));
await to(progressReporter.report(installationProgress.events.FINISHED, installationProgress.status.SUCCESS));
await new Promise((resolve) => {
figlet('CODEFRESH', (err, data) => {
if (err) {
return;
}
console.log(data);
resolve();
});
});
process.exit(); // TODO : This is not needed - needed to be fixed
},
});
Expand Down
2 changes: 2 additions & 0 deletions lib/interface/cli/commands/monitor/install.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const installRoot = require('../root/install.cmd');
const { sdk } = require('../../../../logic');
const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const { DefaultLogFormatter } = require('./../hybrid/helper');

const installMonitorCmd = new Command({
root: false,
Expand Down Expand Up @@ -72,6 +73,7 @@ const installMonitorCmd = new Command({
verbose,
events,
codefreshHost: url,
logFormatting: DefaultLogFormatter,
});
if (monitorInstallStatusCode !== 0) {
throw new Error(`\nCodefresh Monitoring installation failed with code ${monitorInstallStatusCode}`);
Expand Down
2 changes: 2 additions & 0 deletions lib/interface/cli/commands/monitor/uninstall.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const unInstallRoot = require('../root/uninstall.cmd');
const { sdk } = require('../../../../logic');
const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const { DefaultLogFormatter } = require('./../hybrid/helper');


const unInstallAgentCmd = new Command({
Expand Down Expand Up @@ -60,6 +61,7 @@ const unInstallAgentCmd = new Command({
kubeConfigPath,
terminateProcess: false,
events,
logFormatting: DefaultLogFormatter,
});
if (exitCode === 0) {
console.log('Monitor uninsalled successfully');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { sdk } = require('../../../../logic');
const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const { getKubeContext } = require('../../helpers/kubernetes');
const { DefaultLogFormatter } = require('./../hybrid/helper');

const attachAgentToRuntime = async (agent, name) => {
const rt = await sdk.runtimeEnvs.get({ name });
Expand Down Expand Up @@ -141,6 +142,7 @@ const attachRuntimeCmd = new Command({
restartAgent,
terminateProcess: false,
events,
logFormatting: DefaultLogFormatter,
});
if (!restartAgent) {
console.log('Please restart agent\'s pod in order that changes will take effect');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const cliProgress = require('cli-progress');
const createClusterCmd = require('../cluster/create.cmd');
const colors = require('colors');
const _ = require('lodash');
const { DefaultLogFormatter } = require('./../hybrid/helper');

const defaultNamespace = 'codefresh';
const maxRuntimeNameLength = 63;
Expand Down Expand Up @@ -259,6 +260,7 @@ const installRuntimeCmd = new Command({
events: runtimeEvents,
skipClusterTest,
storageClassName,
logFormatting: DefaultLogFormatter,
});
// attach RE to agent in codefresh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { getKubeContext } = require('../../helpers/kubernetes');
const _ = require('lodash');
const ProgressEvents = require('../../helpers/progressEvents');
const cliProgress = require('cli-progress');
const { DefaultLogFormatter } = require('./../hybrid/helper');


const detachRuntimeFromAgent = async (agent, runtimeName) => {
Expand Down Expand Up @@ -140,6 +141,7 @@ const unInstallRuntimeCmd = new Command({
verbose,
terminateProcess: (terminateProcess !== false),
events,
logFormatting: DefaultLogFormatter,
});
},
});
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.64.8",
"version": "0.64.9",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down Expand Up @@ -37,7 +37,7 @@
"cf-errors": "^0.1.12",
"chalk": "^1.1.3",
"cli-progress": "3.6.0",
"codefresh-sdk": "^1.8.6",
"codefresh-sdk": "^1.9.1",
"colors": "^1.1.2",
"columnify": "^1.5.4",
"compare-versions": "^3.4.0",
Expand All @@ -48,6 +48,7 @@
"diff": "^3.5.0",
"dockerode": "^2.5.7",
"draftlog": "^1.0.12",
"figlet": "^1.4.0",
"filesize": "^3.5.11",
"firebase": "git+https://github.com/codefresh-io/firebase.git#80b2ed883ff281cd67b53bd0f6a0bbd6f330fed5",
"flat": "^4.1.0",
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1242,10 +1242,10 @@ code-point-at@^1.0.0:
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=

codefresh-sdk@^1.8.6:
version "1.8.6"
resolved "https://registry.yarnpkg.com/codefresh-sdk/-/codefresh-sdk-1.8.6.tgz#45da5c39e055d2374a8442c06466e9f3bae6d5bf"
integrity sha512-Eg1ZBntuEhYBTOfan0w/k9QaeaeMEc02D5bWtjMPWQRCU8jwaSad/wGY9lq//5A8hSgjJzpXZ7YKeXj5ovDoSQ==
codefresh-sdk@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/codefresh-sdk/-/codefresh-sdk-1.9.1.tgz#fb1b3fd95a2993b65c73b86067f50756f357ec37"
integrity sha512-rAxrHMrJfD1H4j2uyl2+xADsBsvOHyJh/A0T65YjJ/R50Gq7tDE+YF4gw+SGCIZQNjrWELQB3/iyFfJBB+ccuA==
dependencies:
bluebird "^3.5.3"
cf-errors "^0.1.12"
Expand Down Expand Up @@ -2349,6 +2349,11 @@ fd-slicer@~1.1.0:
dependencies:
pend "~1.2.0"

figlet@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.4.0.tgz#21c5878b3752a932ebdb8be400e2d10bbcddfd60"
integrity sha512-CxxIjEKHlqGosgXaIA+sikGDdV6KZOOlzPJnYuPgQlOSHZP5h9WIghYI30fyXnwEVeSH7Hedy72gC6zJrFC+SQ==

figures@^1.3.5:
version "1.7.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
Expand Down