Skip to content

Commit

Permalink
fix(plugin-sript): bash task cannot run with a volume
Browse files Browse the repository at this point in the history
Because it creates locally directory.
  • Loading branch information
loicmathieu committed Aug 5, 2024
1 parent 44a021f commit ebe06f2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import io.kestra.core.models.tasks.runners.PluginUtilsService;
import io.kestra.core.models.tasks.runners.ScriptService;
import io.kestra.core.runners.RunContext;
import io.kestra.plugin.core.runner.Process;
import io.kestra.plugin.scripts.exec.scripts.models.DockerOptions;
import io.kestra.plugin.scripts.exec.scripts.models.RunnerType;
import io.kestra.plugin.scripts.exec.scripts.models.ScriptOutput;
import io.kestra.plugin.scripts.exec.scripts.runners.CommandsWrapper;
import io.kestra.plugin.scripts.runner.docker.Docker;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
Expand Down Expand Up @@ -226,11 +228,15 @@ protected io.kestra.core.tasks.scripts.ScriptOutput run(RunContext runContext, S
commandsSupplier.get()
);

var taskRunner = switch (this.runner) {
case DOCKER -> Docker.from(this.getDockerOptions()).toBuilder().fileHandlingStrategy(Docker.FileHandlingStrategy.MOUNT).build();
case PROCESS -> Process.INSTANCE;
};

ScriptOutput run = new CommandsWrapper(runContext)
.withEnv(this.finalEnv())
.withWarningOnStdErr(this.warningOnStdErr)
.withRunnerType(this.runner)
.withDockerOptions(this.getDockerOptions())
.withTaskRunner(taskRunner)
.withCommands(commandsArgs)
.addAdditionalVars(this.additionalVars)
.run();
Expand Down

0 comments on commit ebe06f2

Please sign in to comment.