forked from che-incubator/chectl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.ts
53 lines (45 loc) · 1.76 KB
/
debug.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*********************************************************************
* Copyright (c) 2019 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
import { Command, flags } from '@oclif/command'
import { integer } from '@oclif/parser/lib/flags'
import * as Listr from 'listr'
import { cheNamespace, listrRenderer, skipKubeHealthzCheck } from '../../common-flags'
import { CheTasks } from '../../tasks/che'
import { ApiTasks } from '../../tasks/platforms/api'
export default class Debug extends Command {
static description = 'Enable local debug of Eclipse Che server'
static flags: flags.Input<any> = {
help: flags.help({ char: 'h' }),
chenamespace: cheNamespace,
'listr-renderer': listrRenderer,
'debug-port': integer({
description: 'Eclipse Che server debug port',
default: 8000
}),
'skip-kubernetes-health-check': skipKubeHealthzCheck
}
async run() {
const { flags } = this.parse(Debug)
const ctx: any = {}
const cheTasks = new CheTasks(flags)
const apiTasks = new ApiTasks()
const tasks = new Listr([], { renderer: flags['listr-renderer'] as any })
tasks.add(apiTasks.testApiTasks(flags, this))
tasks.add(cheTasks.verifyCheNamespaceExistsTask(flags, this))
tasks.add(cheTasks.debugTask(flags))
try {
await tasks.run(ctx)
this.log(`Eclipse Che server debug is available on localhost:${flags['debug-port']}.`)
this.log('The program keeps running to enable port forwarding.')
} catch (error) {
this.error(error)
}
}
}