Skip to content

Commit cedef15

Browse files
Mathieu Gabellemgabelle
authored andcommitted
fix: put TaskRunner back to v1 to enable build
1 parent a38e33a commit cedef15

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.fasterxml.jackson.annotation.JsonSetter;
44
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
5+
import io.kestra.core.models.annotations.Plugin;
6+
import io.kestra.core.models.annotations.PluginProperty;
57
import io.kestra.core.models.property.Property;
68
import io.kestra.core.models.tasks.*;
79
import io.kestra.core.models.tasks.runners.AbstractLogConsumer;
@@ -85,11 +87,12 @@ public abstract class AbstractDbt extends Task implements RunnableTask<ScriptOut
8587
If you change from the default one, be careful to also configure the entrypoint to an empty list if needed."""
8688
)
8789
@Builder.Default
90+
@PluginProperty
8891
@Valid
89-
protected Property<TaskRunner> taskRunner = Property.of(Docker.builder()
92+
protected TaskRunner taskRunner = Docker.builder()
9093
.type(Docker.class.getName())
9194
.entryPoint(Collections.emptyList())
92-
.build());
95+
.build();
9396

9497
@Schema(title = "The task runner container image, only used if the task runner is container-based.")
9598
@Builder.Default
@@ -141,14 +144,14 @@ public void setDockerOptions(Property<DockerOptions> dockerOptions) {
141144
@Override
142145
public ScriptOutput run(RunContext runContext) throws Exception {
143146
CommandsWrapper commandsWrapper = new CommandsWrapper(runContext)
144-
.withEnv(this.getEnv().asMap(runContext, String.class, String.class))
147+
.withEnv(this.getEnv() != null ? this.getEnv().asMap(runContext, String.class, String.class) : Collections.emptyMap())
145148
.withNamespaceFiles(namespaceFiles)
146149
.withInputFiles(inputFiles)
147150
.withOutputFiles(outputFiles)
148-
.withRunnerType(this.getRunner().as(runContext, RunnerType.class))
149-
.withDockerOptions(this.getDocker().as(runContext, DockerOptions.class))
151+
.withRunnerType(this.getRunner() != null ? this.getRunner().as(runContext, RunnerType.class) : null)
152+
.withDockerOptions(this.getDocker() != null ? this.getDocker().as(runContext, DockerOptions.class) : null)
150153
.withContainerImage(this.containerImage.as(runContext, String.class))
151-
.withTaskRunner(this.taskRunner.as(runContext, TaskRunner.class))
154+
.withTaskRunner(this.taskRunner)
152155
.withLogConsumer(new AbstractLogConsumer() {
153156
@Override
154157
public void accept(String line, Boolean isStdErr) {
@@ -158,7 +161,7 @@ public void accept(String line, Boolean isStdErr) {
158161
.withEnableOutputDirectory(true); //force output files on task runners
159162
Path workingDirectory = commandsWrapper.getWorkingDirectory();
160163

161-
String profileString = profiles.as(runContext, String.class);
164+
String profileString = profiles != null ? profiles.as(runContext, String.class) : null;
162165
if (profileString != null && !profileString.isEmpty()) {
163166
if (Files.exists(Path.of(".profiles/profiles.yml"))) {
164167
runContext.logger().warn("A 'profiles.yml' file already exist in the task working directory, it will be overridden.");

src/main/java/io/kestra/plugin/dbt/cli/Setup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public ScriptOutput run(RunContext runContext) throws Exception {
181181
// noinspection ResultOfMethodCallIgnored
182182
profileDir.mkdirs();
183183

184-
String profilesContent = profilesContent(runContext, profiles);
184+
String profilesContent = profilesContent(runContext, profiles.as(runContext, Object.class));
185185
FileUtils.writeStringToFile(
186186
new File(profileDir, "profiles.yml"),
187187
profilesContent,

src/test/java/io/kestra/plugin/dbt/cli/BuildTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void run() throws Exception {
7979
env.put("GOOGLE_APPLICATION_CREDENTIALS", runContext.workingDir().resolve(Path.of("sa.json")).toString());
8080
Build task = Build.builder()
8181
.thread((Property.of(8)))
82-
.taskRunner(Property.of(Process.instance()))
82+
.taskRunner(Process.instance())
8383
.env(Property.of(env))
8484
.build();
8585

src/test/java/io/kestra/plugin/dbt/cli/DbtCLITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void run() throws Exception {
5353
location: US
5454
method: service-account
5555
priority: interactive
56-
project: kestra-dev
56+
project: kestra-unit-test
5757
threads: 1
5858
timeout_seconds: 300
5959
type: bigquery

0 commit comments

Comments
 (0)