Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options: ['helm', 'operator', 'minishift-addon'],
default: ''
}),
platform: string({
char: 'p',
description: 'Type of Kubernetes platform. Valid values are \"minikube\", \"minishift\", \"k8s (for kubernetes)\", \"openshift\", \"crc (for CodeReady Containers)\", \"microk8s\".',
options: ['minikube', 'minishift', 'k8s', 'openshift', 'microk8s', 'docker-desktop', 'crc'],
}),
chenamespace: cheNamespace,
templates: string({
char: 't',
description: 'Path to the templates folder',
default: Update.getTemplatesDir(),
env: 'CHE_TEMPLATES_FOLDER'
}),
'che-operator-image': string({
description: 'Container image of the operator. This parameter is used only when the installer is the operator',
default: DEFAULT_CHE_OPERATOR_IMAGE
}),
'skip-version-check': boolean({
description: 'Skip user confirmation on version check',
default: false
}),
'deployment-name': cheDeployment,
'listr-renderer': listrRenderer,
help: flags.help({ char: 'h' }),
}
static getTemplatesDir(): string {
// return local templates folder if present
const TEMPLATES = 'templates'
const templatesDir = path.resolve(TEMPLATES)
static flags = {
help: flags.help({ char: 'h' }),
kubeconfig: flags.boolean({
char: 'k',
description: 'Inject the local Kubernetes configuration'
}),
workspace: string({
char: 'w',
description: 'Target workspace. Can be omitted if only one Workspace is running'
}),
container: string({
char: 'c',
description: 'Target container. If not specified, configuration files will be injected in all containers of a Che Workspace pod',
required: false
}),
'kube-context': string({
description: 'Kubeconfig context to inject',
required: false
}),
chenamespace: cheNamespace,
'listr-renderer': listrRenderer
}
async run() {
const { flags } = this.parse(Inject)
const notifier = require('node-notifier')
const cheTasks = new CheTasks(flags)
const tasks = new Listr([], { renderer: flags['listr-renderer'] as any })
tasks.add(cheTasks.verifyCheNamespaceExistsTask(flags, this))
tasks.add(cheTasks.verifyWorkspaceRunTask(flags, this))
tasks.add([
export default class Start extends Command {
static description = 'start Eclipse Che Server'
static flags = {
help: flags.help({ char: 'h' }),
chenamespace: cheNamespace,
'listr-renderer': listrRenderer,
'deployment-name': cheDeployment,
cheimage: string({
char: 'i',
description: 'Che server container image',
default: DEFAULT_CHE_IMAGE,
env: 'CHE_CONTAINER_IMAGE'
}),
templates: string({
char: 't',
description: 'Path to the templates folder',
default: Start.getTemplatesDir(),
env: 'CHE_TEMPLATES_FOLDER'
}),
'devfile-registry-url': string({
description: 'The URL of the external Devfile registry.',
env: 'CHE_WORKSPACE_DEVFILE__REGISTRY__URL'
}),
'plugin-registry-url': string({
description: 'The URL of the external plugin registry.',
env: 'CHE_WORKSPACE_PLUGIN__REGISTRY__URL'
}),
cheboottimeout: string({
char: 'o',
description: 'Che server bootstrap timeout (in milliseconds)',
import { string } from '@oclif/parser/lib/flags'
export const cheNamespace = string({
char: 'n',
description: 'Kubernetes namespace where Che server is supposed to be deployed',
default: 'che',
env: 'CHE_NAMESPACE'
})
export const cheDeployment = string({
description: 'Che deployment name',
default: 'che',
env: 'CHE_DEPLOYMENT'
})
export const listrRenderer = string({
description: 'Listr renderer',
options: ['default', 'silent', 'verbose'],
default: 'default'
})
export const accessToken = string({
description: 'Che OIDC Access Token',
env: 'CHE_ACCESS_TOKEN'
})
static description = 'generate and print a devfile to stdout given some Kubernetes resources and other Che workspaces features (project, language-support, commands etc...)'
static flags = {
help: flags.help({ char: 'h' }),
name: string({
description: 'Workspace name',
default: '',
env: 'WSNAME',
required: false,
}),
dockerimage: string({
description: 'dockerimage component to include in the Devfile',
env: 'DOCKERIMAGE',
required: false,
}),
namespace: string({
description: 'Kubernetes namespace where the resources are defined',
default: '',
env: 'NAMESPACE',
required: false,
}),
editor: string({
description: `Specify the Che editor component. Currently supported editors: ${editors}`,
env: 'EDITOR',
required: false,
}),
selector: string({
description: 'label selector to filter the Kubernetes resources. For example --selector="app.kubernetes.io/name=employee-manager"',
env: 'SELECTOR',
required: false,
}),
language: string({
selector: string({
description: 'label selector to filter the Kubernetes resources. For example --selector="app.kubernetes.io/name=employee-manager"',
env: 'SELECTOR',
required: false,
}),
language: string({
description: `Add support for a particular language. Currently supported languages: ${languages}`,
env: 'LANGUAGE_SUPPORT',
required: false,
}),
plugin: string({
description: 'Che plugin to include in the workspace. The format is JSON. For example this is a valid Che Plugin specification: {"type": "TheEndpointName.ChePlugin", "alias": "java-ls", "id": "redhat/java/0.38.0"}',
env: 'CHE_PLUGIN',
required: false,
}),
'git-repo': string({
description: 'Source code git repository to include in the workspace',
env: 'GIT_REPO',
required: false,
}),
command: string({
description: 'Command to include in the workspace',
env: 'COMMAND',
required: false,
}),
}
async run() {
const { flags } = this.parse(Generate)
kube = new KubeHelper(flags)
const notifier = require('node-notifier')
env: 'CHE_NAMESPACE'
})
export const cheDeployment = string({
description: 'Che deployment name',
default: 'che',
env: 'CHE_DEPLOYMENT'
})
export const listrRenderer = string({
description: 'Listr renderer',
options: ['default', 'silent', 'verbose'],
default: 'default'
})
export const accessToken = string({
description: 'Che OIDC Access Token',
env: 'CHE_ACCESS_TOKEN'
})
language: string({
description: `Add support for a particular language. Currently supported languages: ${languages}`,
env: 'LANGUAGE_SUPPORT',
required: false,
}),
plugin: string({
description: 'Che plugin to include in the workspace. The format is JSON. For example this is a valid Che Plugin specification: {"type": "TheEndpointName.ChePlugin", "alias": "java-ls", "id": "redhat/java/0.38.0"}',
env: 'CHE_PLUGIN',
required: false,
}),
'git-repo': string({
description: 'Source code git repository to include in the workspace',
env: 'GIT_REPO',
required: false,
}),
command: string({
description: 'Command to include in the workspace',
env: 'COMMAND',
required: false,
}),
}
async run() {
const { flags } = this.parse(Generate)
kube = new KubeHelper(flags)
const notifier = require('node-notifier')
let name = flags.name || 'chectl-generated'
let devfile: Devfile = {
apiVersion: '1.0.0',
metadata: {
['theia-next', { type: TheEndpointName.CheEditor, alias: 'theia-editor', id: 'eclipse/che-theia/next' }],
['theia-1.0.0', { type: TheEndpointName.CheEditor, alias: 'theia-editor', id: 'eclipse/che-theia/1.0.0' }]
])
export default class Generate extends Command {
static description = 'generate and print a devfile to stdout given some Kubernetes resources and other Che workspaces features (project, language-support, commands etc...)'
static flags = {
help: flags.help({ char: 'h' }),
name: string({
description: 'Workspace name',
default: '',
env: 'WSNAME',
required: false,
}),
dockerimage: string({
description: 'dockerimage component to include in the Devfile',
env: 'DOCKERIMAGE',
required: false,
}),
namespace: string({
description: 'Kubernetes namespace where the resources are defined',
default: '',
env: 'NAMESPACE',
required: false,
}),
editor: string({
description: `Specify the Che editor component. Currently supported editors: ${editors}`,
env: 'EDITOR',
required: false,
}),
selector: string({
import { cheNamespace, listrRenderer } from '../../common-flags'
import { CheTasks } from '../../tasks/che'
import { K8sTasks } from '../../tasks/platforms/k8s'
export default class Logs extends Command {
static description = 'Collect workspace logs'
static flags = {
help: flags.help({ char: 'h' }),
chenamespace: cheNamespace,
'listr-renderer': listrRenderer,
follow: flags.boolean({
description: 'Follow workspace creation logs',
default: false
}),
workspace: string({
char: 'w',
description: 'Target workspace. Can be omitted if only one Workspace is running'
}),
directory: string({
char: 'd',
description: 'Directory to store logs into',
default: './logs'
})
}
async run() {
const { flags } = this.parse(Logs)
const cheTasks = new CheTasks(flags)
const k8sTasks = new K8sTasks()
const tasks = new Listr([], { renderer: flags['listr-renderer'] as any })