From a2624cf2342d0ee90e198e1a4f512954e9256a0a Mon Sep 17 00:00:00 2001 From: Roman Nikitenko Date: Tue, 23 Jul 2019 17:31:22 +0300 Subject: [PATCH] Use 'containerName' instead of 'machineName' for che tasks Signed-off-by: Roman Nikitenko --- plugins/task-plugin/src/task/che-task-provider.ts | 6 +++--- plugins/task-plugin/src/task/che-task-runner.ts | 12 ++++++------ plugins/task-plugin/src/task/converter.ts | 5 +++-- plugins/task-plugin/src/task/task-protocol.ts | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/task-plugin/src/task/che-task-provider.ts b/plugins/task-plugin/src/task/che-task-provider.ts index c81d1c4b2..61cc9bd6a 100644 --- a/plugins/task-plugin/src/task/che-task-provider.ts +++ b/plugins/task-plugin/src/task/che-task-provider.ts @@ -45,10 +45,10 @@ export class CheTaskProvider { resultTarget.workspaceId = await this.cheWorkspaceClient.getWorkspaceId(); } - if (target && target.machineName) { - resultTarget.machineName = target.machineName; + if (target && target.containerName) { + resultTarget.containerName = target.containerName; } else { - resultTarget.machineName = await this.machinePicker.pick(); + resultTarget.containerName = await this.machinePicker.pick(); } if (target && target.workingDir) { diff --git a/plugins/task-plugin/src/task/che-task-runner.ts b/plugins/task-plugin/src/task/che-task-runner.ts index 11dcc87b1..fc36a3748 100644 --- a/plugins/task-plugin/src/task/che-task-runner.ts +++ b/plugins/task-plugin/src/task/che-task-runner.ts @@ -10,7 +10,7 @@ import { injectable, inject, postConstruct } from 'inversify'; import * as che from '@eclipse-che/plugin'; -import { CHE_TASK_TYPE } from './task-protocol'; +import { CHE_TASK_TYPE, Target } from './task-protocol'; import { MachineExecClient } from '../machine/machine-exec-client'; import { ProjectPathVariableResolver } from '../variable/project-path-variable-resolver'; import { MachineExecWatcher } from '../machine/machine-exec-watcher'; @@ -50,14 +50,14 @@ export class CheTaskRunner { throw new Error(`Unsupported task type: ${type}`); } - const target = definition.target; + const target: Target = definition.target; if (!target) { throw new Error("Che task config must have 'target' property specified"); } - const machineName = target.machineName; - if (!machineName) { - throw new Error("Che task config must have 'target.machineName' property specified"); + const containerName = target.containerName; + if (!containerName) { + throw new Error("Che task config must have 'target.containerName' property specified"); } try { @@ -68,7 +68,7 @@ export class CheTaskRunner { shellArgs: ['-c', `${taskConfig.command}`], attributes: { - CHE_MACHINE_NAME: machineName, + CHE_MACHINE_NAME: containerName, closeWidgetExitOrError: 'false', } }; diff --git a/plugins/task-plugin/src/task/converter.ts b/plugins/task-plugin/src/task/converter.ts index 3b6960e22..36ee0c46d 100644 --- a/plugins/task-plugin/src/task/converter.ts +++ b/plugins/task-plugin/src/task/converter.ts @@ -21,10 +21,11 @@ export function toTaskConfiguration(command: cheApi.workspace.Command): TaskConf command: command.commandLine, target: { workingDir: this.getCommandAttribute(command, WORKING_DIR_ATTRIBUTE), - machineName: this.getCommandAttribute(command, MACHINE_NAME_ATTRIBUTE) + containerName: this.getCommandAttribute(command, MACHINE_NAME_ATTRIBUTE) }, previewUrl: this.getCommandAttribute(command, PREVIEW_URL_ATTRIBUTE) }; + return taskConfig; } @@ -36,7 +37,7 @@ export function toTask(command: cheApi.workspace.Command): Task { command: command.commandLine, target: { workingDir: this.getCommandAttribute(command, WORKING_DIR_ATTRIBUTE), - machineName: this.getCommandAttribute(command, MACHINE_NAME_ATTRIBUTE) + containerName: this.getCommandAttribute(command, MACHINE_NAME_ATTRIBUTE) }, previewUrl: this.getCommandAttribute(command, PREVIEW_URL_ATTRIBUTE) }, diff --git a/plugins/task-plugin/src/task/task-protocol.ts b/plugins/task-plugin/src/task/task-protocol.ts index 8db33ae08..f6ca298f8 100644 --- a/plugins/task-plugin/src/task/task-protocol.ts +++ b/plugins/task-plugin/src/task/task-protocol.ts @@ -23,6 +23,6 @@ export interface CheTaskDefinition extends TaskDefinition { export interface Target { workspaceId?: string, - machineName?: string, + containerName?: string, workingDir?: string }