diff --git a/src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java b/src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java index e992125..e8e00ea 100644 --- a/src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java +++ b/src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.annotation.JsonSetter; import io.kestra.core.exceptions.IllegalVariableEvaluationException; -import io.kestra.core.models.annotations.Plugin; import io.kestra.core.models.annotations.PluginProperty; import io.kestra.core.models.property.Property; import io.kestra.core.models.tasks.*; diff --git a/src/main/java/io/kestra/plugin/dbt/cli/DbtCLI.java b/src/main/java/io/kestra/plugin/dbt/cli/DbtCLI.java index 45c3035..549503e 100644 --- a/src/main/java/io/kestra/plugin/dbt/cli/DbtCLI.java +++ b/src/main/java/io/kestra/plugin/dbt/cli/DbtCLI.java @@ -181,7 +181,8 @@ public class DbtCLI extends AbstractExecScript { ) @NotNull @NotEmpty - private Property> commands; + @PluginProperty(dynamic = true) + private List commands; @Schema( title = "The `profiles.yml` file content.", @@ -266,7 +267,7 @@ public void accept(String line, Boolean isStdErr) { List commandsArgs = ScriptService.scriptCommands( this.interpreter, this.getBeforeCommandsWithOptions(), - this.commands.asList(runContext, String.class).stream().map(command -> command.concat(" --log-format json")).toList() + runContext.render(this.commands).stream().map(command -> command.concat(" --log-format json")).toList() ); // check that if a command uses --project-dir, the projectDir must be set diff --git a/src/main/java/io/kestra/plugin/dbt/cli/Setup.java b/src/main/java/io/kestra/plugin/dbt/cli/Setup.java index 03b1ff4..2623166 100644 --- a/src/main/java/io/kestra/plugin/dbt/cli/Setup.java +++ b/src/main/java/io/kestra/plugin/dbt/cli/Setup.java @@ -110,7 +110,8 @@ public class Setup extends AbstractExecScript implements RunnableTask pythonPath = Property.of(DEFAULT_IMAGE); + @PluginProperty(dynamic = true) + private final String pythonPath = DEFAULT_IMAGE; @Schema( title = "List of python dependencies to add to the python execution process.", @@ -213,7 +214,7 @@ public ScriptOutput run(RunContext runContext) throws Exception { private List virtualEnvCommand(RunContext runContext, Path workingDirectory, List requirements) throws IllegalVariableEvaluationException { List renderer = new ArrayList<>(); - renderer.add(this.pythonPath.as(runContext, String.class) + " -m venv --system-site-packages " + workingDirectory + " > /dev/null"); + renderer.add(runContext.render(this.pythonPath) + " -m venv --system-site-packages " + workingDirectory + " > /dev/null"); if (requirements != null) { renderer.addAll(Arrays.asList( diff --git a/src/test/java/io/kestra/plugin/dbt/cli/DbtCLITest.java b/src/test/java/io/kestra/plugin/dbt/cli/DbtCLITest.java index 1209737..c29ee6b 100644 --- a/src/test/java/io/kestra/plugin/dbt/cli/DbtCLITest.java +++ b/src/test/java/io/kestra/plugin/dbt/cli/DbtCLITest.java @@ -62,7 +62,7 @@ void run() throws Exception { """) ) .containerImage("ghcr.io/kestra-io/dbt-bigquery:latest") - .commands(Property.of(List.of("dbt build"))) + .commands(List.of("dbt build")) .build(); RunContext runContext = TestsUtils.mockRunContext(runContextFactory, execute, Map.of());