Skip to content
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

feat: Add ability to duplicate some messages at the end of chectl output #619

Merged
merged 1 commit into from
Apr 3, 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
26 changes: 22 additions & 4 deletions src/commands/server/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ export default class Start extends Command {
ctx.directory = path.resolve(flags.directory ? flags.directory : path.resolve(os.tmpdir(), 'chectl-logs', Date.now().toString()))
const listrOptions: Listr.ListrOptions = { renderer: (flags['listr-renderer'] as any), collapse: false, showSubtasks: true } as Listr.ListrOptions
ctx.listrOptions = listrOptions
// Holds messages which should be printed at the end of chectl log
ctx.highlightedMessages = [] as string[]

const cheTasks = new CheTasks(flags)
const platformTasks = new PlatformTasks()
Expand All @@ -281,10 +283,26 @@ export default class Start extends Command {
}], listrOptions)

// Post Install Checks
const postInstallTasks = new Listr([{
title: '✅ Post installation checklist',
task: () => new Listr(cheTasks.waitDeployedChe(flags, this))
}], listrOptions)
const postInstallTasks = new Listr([
{
title: '✅ Post installation checklist',
task: () => new Listr(cheTasks.waitDeployedChe(flags, this))
},
{
title: 'Show important messages',
enabled: ctx => ctx.highlightedMessages.length > 0,
task: (ctx: any) => {
const printMessageTasks = new Listr([], ctx.listrOptions)
for (const message of ctx.highlightedMessages) {
printMessageTasks.add({
title: message,
task: () => { }
})
}
return printMessageTasks
}
}
], listrOptions)

const logsTasks = new Listr([{
title: 'Start following logs',
Expand Down
6 changes: 4 additions & 2 deletions src/tasks/component-installers/cert-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class CertManagerTasks {
},
{
title: 'Add local Eclipse Che CA certificate into browser',
task: async (_ctx: any, task: any) => {
task: async (ctx: any, task: any) => {
const cheSecret = await this.kubeHelper.getSecret(CHE_TLS_SECRET_NAME, flags.chenamespace)
if (cheSecret && cheSecret.data) {
const cheCaCrt = Buffer.from(cheSecret.data['ca.crt'], 'base64').toString('ascii')
Expand All @@ -171,7 +171,9 @@ export class CertManagerTasks {

const yellow = '\x1b[33m'
const noColor = '\x1b[0m'
task.title = `❗${yellow}[MANUAL ACTION REQUIRED]${noColor} Please add local Eclipse Che CA certificate into your browser: ${cheCaPublicCertPath}`
const message = `❗${yellow}[MANUAL ACTION REQUIRED]${noColor} Please add local Eclipse Che CA certificate into your browser: ${cheCaPublicCertPath}`
task.title = message
ctx.highlightedMessages.push(message)
} else {
throw new Error('Failed to get Cert Manager CA secret')
}
Expand Down