Skip to content

Commit a726018

Browse files
authored
refactor: dynamic properties (#26)
1 parent d1ac5de commit a726018

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/io/kestra/plugin/sqlmesh/cli/SQLMeshCLI.java

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

33
import io.kestra.core.models.annotations.Example;
44
import io.kestra.core.models.annotations.Plugin;
5+
import io.kestra.core.models.property.Property;
56
import io.kestra.core.models.tasks.*;
67
import io.kestra.core.models.tasks.runners.ScriptService;
78
import io.kestra.core.models.tasks.runners.TaskRunner;
@@ -106,10 +107,11 @@ public class SQLMeshCLI extends Task implements RunnableTask<ScriptOutput>, Name
106107

107108
private Object inputFiles;
108109

109-
private List<String> outputFiles;
110+
private Property<List<String>> outputFiles;
110111

111112
@Override
112113
public ScriptOutput run(RunContext runContext) throws Exception {
114+
var renderedOutputFiles = runContext.render(this.outputFiles).asList(String.class);
113115
return new CommandsWrapper(runContext)
114116
.withWarningOnStdErr(false)
115117
.withDockerOptions(injectDefaults(getDocker()))
@@ -118,7 +120,7 @@ public ScriptOutput run(RunContext runContext) throws Exception {
118120
.withEnv(Optional.ofNullable(env).orElse(new HashMap<>()))
119121
.withNamespaceFiles(namespaceFiles)
120122
.withInputFiles(inputFiles)
121-
.withOutputFiles(outputFiles)
123+
.withOutputFiles(renderedOutputFiles.isEmpty() ? null : renderedOutputFiles)
122124
.withCommands(
123125
ScriptService.scriptCommands(
124126
List.of("/bin/sh", "-c"),

0 commit comments

Comments
 (0)