From 8af4e250d784dd70818e3ab42e8202988cc85707 Mon Sep 17 00:00:00 2001 From: Mathieu Gabelle Date: Thu, 2 Jan 2025 10:40:00 +0100 Subject: [PATCH] refactor: migrate clickhouse cli to dynamic properties --- .../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"),