Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Use 'containerName' instead of 'machineName' for che tasks
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
  • Loading branch information
RomanNikitenko committed Aug 22, 2019
1 parent 960a7cf commit 86a8414
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions plugins/task-plugin/src/task/che-task-provider.ts
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions plugins/task-plugin/src/task/che-task-runner.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand All @@ -68,7 +68,7 @@ export class CheTaskRunner {
shellArgs: ['-c', `${taskConfig.command}`],

attributes: {
CHE_MACHINE_NAME: machineName,
CHE_MACHINE_NAME: containerName,
closeWidgetExitOrError: 'false',
}
};
Expand Down
5 changes: 3 additions & 2 deletions plugins/task-plugin/src/task/converter.ts
Expand Up @@ -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;
}

Expand All @@ -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)
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/task-plugin/src/task/task-protocol.ts
Expand Up @@ -22,6 +22,6 @@ export interface CheTaskDefinition extends TaskDefinition {

export interface Target {
workspaceId?: string,
machineName?: string,
containerName?: string,
workingDir?: string
}

0 comments on commit 86a8414

Please sign in to comment.