From 8594ce2d8848d92f0db3da5ac57b57030678190b Mon Sep 17 00:00:00 2001 From: Mathieu Gabelle <54168385+mgabelle@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:56:58 +0100 Subject: [PATCH] refactor: migrate clickhouse cli to dynamic properties (#476) --- .../kestra/plugin/jdbc/clickhouse/ClickHouseLocalCLI.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin-jdbc-clickhouse/src/main/java/io/kestra/plugin/jdbc/clickhouse/ClickHouseLocalCLI.java b/plugin-jdbc-clickhouse/src/main/java/io/kestra/plugin/jdbc/clickhouse/ClickHouseLocalCLI.java index 35dbe809..ea85ac8c 100644 --- a/plugin-jdbc-clickhouse/src/main/java/io/kestra/plugin/jdbc/clickhouse/ClickHouseLocalCLI.java +++ b/plugin-jdbc-clickhouse/src/main/java/io/kestra/plugin/jdbc/clickhouse/ClickHouseLocalCLI.java @@ -3,6 +3,7 @@ import io.kestra.core.models.annotations.Example; 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.*; import io.kestra.core.models.tasks.runners.ScriptService; import io.kestra.core.models.tasks.runners.TaskRunner; @@ -92,10 +93,12 @@ public class ClickHouseLocalCLI extends Task implements RunnableTask outputFiles; + private Property> outputFiles; @Override public ScriptOutput run(RunContext runContext) throws Exception { + var renderedOutputFiles = runContext.render(this.outputFiles).asList(String.class); + return new CommandsWrapper(runContext) .withWarningOnStdErr(true) .withTaskRunner(this.taskRunner) @@ -103,7 +106,7 @@ public ScriptOutput run(RunContext runContext) throws Exception { .withEnv(Optional.ofNullable(env).orElse(new HashMap<>())) .withNamespaceFiles(namespaceFiles) .withInputFiles(inputFiles) - .withOutputFiles(outputFiles) + .withOutputFiles(renderedOutputFiles.isEmpty() ? null : renderedOutputFiles) .withCommands( ScriptService.scriptCommands( List.of("clickhouse-local"),