Skip to content

Commit

Permalink
feat: task runner
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Jun 25, 2024
1 parent 4b63548 commit 55a6524
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main/java/io/kestra/plugin/malloy/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.tasks.runners.ScriptService;
import io.kestra.core.models.tasks.runners.TaskRunner;
import io.kestra.core.runners.RunContext;
import io.kestra.plugin.scripts.exec.AbstractExecScript;
import io.kestra.plugin.scripts.exec.scripts.models.DockerOptions;
import io.kestra.plugin.scripts.exec.scripts.models.ScriptOutput;
import io.kestra.plugin.scripts.runner.docker.Docker;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import lombok.*;
import lombok.experimental.SuperBuilder;

Expand Down Expand Up @@ -60,8 +62,19 @@ public class CLI extends AbstractExecScript {
@PluginProperty(dynamic = true)
protected List<String> commands;

@Schema(
title = "The task runner to use.",
description = "Task runners are provided by plugins, each have their own properties."
)
@PluginProperty
@Builder.Default
@Valid
private TaskRunner taskRunner = Docker.INSTANCE;

@Schema(title = "The task runner container image, only used if the task runner is container-based.")
@PluginProperty(dynamic = true)
@Builder.Default
protected String containerImage = DEFAULT_IMAGE;
private String containerImage = DEFAULT_IMAGE;

@Override
public ScriptOutput run(RunContext runContext) throws Exception {
Expand All @@ -72,6 +85,8 @@ public ScriptOutput run(RunContext runContext) throws Exception {
);

return this.commands(runContext)
.withTaskRunner(this.taskRunner)
.withContainerImage(this.containerImage)
.withCommands(commandsArgs)
.run();
}
Expand Down

0 comments on commit 55a6524

Please # to comment.