diff --git a/gradle.properties b/gradle.properties index dc34a63..5b443d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ version=1.2.1-SNAPSHOT -kestraVersion=1.2.0 +kestraVersion=1.2.1 diff --git a/src/main/java/io/kestra/plugin/git/NamespaceSync.java b/src/main/java/io/kestra/plugin/git/NamespaceSync.java index 1dc3b19..214e63d 100644 --- a/src/main/java/io/kestra/plugin/git/NamespaceSync.java +++ b/src/main/java/io/kestra/plugin/git/NamespaceSync.java @@ -5,6 +5,7 @@ import io.kestra.core.exceptions.KestraRuntimeException; import io.kestra.core.models.annotations.Example; import io.kestra.core.models.annotations.Plugin; +import io.kestra.core.models.flows.FlowSource; import io.kestra.core.models.flows.FlowWithSource; import io.kestra.core.models.property.Property; import io.kestra.core.models.tasks.RunnableTask; @@ -301,7 +302,7 @@ private void planFlows(RunContext rc, Path baseDir, GitTree gitTree, KestraState diff.add(DiffLine.added(fileRel, key, Kind.FLOW)); if (!rDryRun) apply.add(() -> { try { - var flowValidated = fs.validate(rc.flowInfo().tenantId(), gitNode.rawYaml).getFirst(); + var flowValidated = fs.validate(rc.flowInfo().tenantId(), List.of(new FlowSource(key, gitNode.rawYaml))).getFirst(); if (flowValidated.getConstraints() != null) { throw new FlowProcessingException(flowValidated.getConstraints()); @@ -360,7 +361,7 @@ private void planFlows(RunContext rc, Path baseDir, GitTree gitTree, KestraState diff.add(DiffLine.updatedKestra(fileRel, key, Kind.FLOW)); if (!rDryRun) apply.add(() -> { try { - var flowValidated = fs.validate(rc.flowInfo().tenantId(), gitNode.rawYaml).getFirst(); + var flowValidated = fs.validate(rc.flowInfo().tenantId(), List.of(new FlowSource(key, gitNode.rawYaml))).getFirst(); if (flowValidated.getConstraints() != null) { throw new FlowProcessingException(flowValidated.getConstraints()); diff --git a/src/main/java/io/kestra/plugin/git/SyncFlows.java b/src/main/java/io/kestra/plugin/git/SyncFlows.java index 59e249d..f5e21e0 100644 --- a/src/main/java/io/kestra/plugin/git/SyncFlows.java +++ b/src/main/java/io/kestra/plugin/git/SyncFlows.java @@ -5,19 +5,18 @@ import io.kestra.core.models.annotations.Example; import io.kestra.core.models.annotations.Plugin; import io.kestra.core.models.flows.Flow; +import io.kestra.core.models.flows.FlowSource; import io.kestra.core.models.flows.FlowWithException; import io.kestra.core.models.flows.FlowWithSource; import io.kestra.core.models.property.Property; import io.kestra.core.runners.DefaultRunContext; import io.kestra.core.runners.RunContext; import io.kestra.core.services.FlowService; -import io.kestra.sdk.KestraClient; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.experimental.SuperBuilder; import org.apache.commons.io.IOUtils; -import org.eclipse.jgit.api.Git; import java.io.IOException; import java.io.InputStream; @@ -204,7 +203,7 @@ protected Flow simulateResourceWrite(RunContext runContext, String renderedNames String flowSource = SyncFlows.replaceNamespace(renderedNamespace, uri, inputStream); - var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), flowSource).getFirst(); + var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), List.of(new FlowSource(null, flowSource))).getFirst(); if (flowValidated.getConstraints() != null) { var ref = uri.getPath(); @@ -245,7 +244,7 @@ protected Flow writeResource(RunContext runContext, String renderedNamespace, UR String flowSource = SyncFlows.replaceNamespace(renderedNamespace, uri, inputStream); - var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), flowSource).getFirst(); + var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), List.of(new FlowSource(null, flowSource))).getFirst(); if (flowValidated.getConstraints() != null) { var ref = uri.getPath();