Skip to content

Commit 251044b

Browse files
Mathieu Gabellemgabelle
authored andcommitted
fix(v2 property): back to v1 when annotation != @NotNull
V2 properties does not support other annotations than @NotNull for now. To prevent bugs we just revert the properties to v1 when other annotations are involved
1 parent cedef15 commit 251044b

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.fasterxml.jackson.annotation.JsonSetter;
44
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
5-
import io.kestra.core.models.annotations.Plugin;
65
import io.kestra.core.models.annotations.PluginProperty;
76
import io.kestra.core.models.property.Property;
87
import io.kestra.core.models.tasks.*;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public class DbtCLI extends AbstractExecScript {
181181
)
182182
@NotNull
183183
@NotEmpty
184-
private Property<List<String>> commands;
184+
@PluginProperty(dynamic = true)
185+
private List<String> commands;
185186

186187
@Schema(
187188
title = "The `profiles.yml` file content.",
@@ -266,7 +267,7 @@ public void accept(String line, Boolean isStdErr) {
266267
List<String> commandsArgs = ScriptService.scriptCommands(
267268
this.interpreter,
268269
this.getBeforeCommandsWithOptions(),
269-
this.commands.asList(runContext, String.class).stream().map(command -> command.concat(" --log-format json")).toList()
270+
runContext.render(this.commands).stream().map(command -> command.concat(" --log-format json")).toList()
270271
);
271272

272273
// check that if a command uses --project-dir, the projectDir must be set

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ public class Setup extends AbstractExecScript implements RunnableTask<ScriptOutp
110110
)
111111
@NotNull
112112
@NotEmpty
113-
private final Property<String> pythonPath = Property.of(DEFAULT_IMAGE);
113+
@PluginProperty(dynamic = true)
114+
private final String pythonPath = DEFAULT_IMAGE;
114115

115116
@Schema(
116117
title = "List of python dependencies to add to the python execution process.",
@@ -213,7 +214,7 @@ public ScriptOutput run(RunContext runContext) throws Exception {
213214
private List<String> virtualEnvCommand(RunContext runContext, Path workingDirectory, List<String> requirements) throws IllegalVariableEvaluationException {
214215
List<String> renderer = new ArrayList<>();
215216

216-
renderer.add(this.pythonPath.as(runContext, String.class) + " -m venv --system-site-packages " + workingDirectory + " > /dev/null");
217+
renderer.add(runContext.render(this.pythonPath) + " -m venv --system-site-packages " + workingDirectory + " > /dev/null");
217218

218219
if (requirements != null) {
219220
renderer.addAll(Arrays.asList(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void run() throws Exception {
6262
""")
6363
)
6464
.containerImage("ghcr.io/kestra-io/dbt-bigquery:latest")
65-
.commands(Property.of(List.of("dbt build")))
65+
.commands(List.of("dbt build"))
6666
.build();
6767

6868
RunContext runContext = TestsUtils.mockRunContext(runContextFactory, execute, Map.of());

0 commit comments

Comments
 (0)