22
33import com .fasterxml .jackson .annotation .JsonSetter ;
44import io .kestra .core .exceptions .IllegalVariableEvaluationException ;
5+ import io .kestra .core .models .annotations .Plugin ;
6+ import io .kestra .core .models .annotations .PluginProperty ;
57import io .kestra .core .models .property .Property ;
68import io .kestra .core .models .tasks .*;
79import io .kestra .core .models .tasks .runners .AbstractLogConsumer ;
@@ -85,11 +87,12 @@ public abstract class AbstractDbt extends Task implements RunnableTask<ScriptOut
8587 If you change from the default one, be careful to also configure the entrypoint to an empty list if needed."""
8688 )
8789 @ Builder .Default
90+ @ PluginProperty
8891 @ Valid
89- protected Property < TaskRunner > taskRunner = Property . of ( Docker .builder ()
92+ protected TaskRunner taskRunner = Docker .builder ()
9093 .type (Docker .class .getName ())
9194 .entryPoint (Collections .emptyList ())
92- .build ()) ;
95+ .build ();
9396
9497 @ Schema (title = "The task runner container image, only used if the task runner is container-based." )
9598 @ Builder .Default
@@ -141,14 +144,14 @@ public void setDockerOptions(Property<DockerOptions> dockerOptions) {
141144 @ Override
142145 public ScriptOutput run (RunContext runContext ) throws Exception {
143146 CommandsWrapper commandsWrapper = new CommandsWrapper (runContext )
144- .withEnv (this .getEnv (). asMap (runContext , String .class , String .class ))
147+ .withEnv (this .getEnv () != null ? this . getEnv (). asMap (runContext , String .class , String .class ) : Collections . emptyMap ( ))
145148 .withNamespaceFiles (namespaceFiles )
146149 .withInputFiles (inputFiles )
147150 .withOutputFiles (outputFiles )
148- .withRunnerType (this .getRunner (). as (runContext , RunnerType .class ))
149- .withDockerOptions (this .getDocker (). as (runContext , DockerOptions .class ))
151+ .withRunnerType (this .getRunner () != null ? this . getRunner (). as (runContext , RunnerType .class ) : null )
152+ .withDockerOptions (this .getDocker () != null ? this . getDocker (). as (runContext , DockerOptions .class ) : null )
150153 .withContainerImage (this .containerImage .as (runContext , String .class ))
151- .withTaskRunner (this .taskRunner . as ( runContext , TaskRunner . class ) )
154+ .withTaskRunner (this .taskRunner )
152155 .withLogConsumer (new AbstractLogConsumer () {
153156 @ Override
154157 public void accept (String line , Boolean isStdErr ) {
@@ -158,7 +161,7 @@ public void accept(String line, Boolean isStdErr) {
158161 .withEnableOutputDirectory (true ); //force output files on task runners
159162 Path workingDirectory = commandsWrapper .getWorkingDirectory ();
160163
161- String profileString = profiles .as (runContext , String .class );
164+ String profileString = profiles != null ? profiles .as (runContext , String .class ) : null ;
162165 if (profileString != null && !profileString .isEmpty ()) {
163166 if (Files .exists (Path .of (".profiles/profiles.yml" ))) {
164167 runContext .logger ().warn ("A 'profiles.yml' file already exist in the task working directory, it will be overridden." );
0 commit comments