Skip to content

Commit 14a7a5a

Browse files
fix: sync to be compatible with kestra version
1 parent bf28265 commit 14a7a5a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version=1.2.1-SNAPSHOT
2-
kestraVersion=1.2.0
2+
kestraVersion=1.2.1

src/main/java/io/kestra/plugin/git/NamespaceSync.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.kestra.core.exceptions.KestraRuntimeException;
66
import io.kestra.core.models.annotations.Example;
77
import io.kestra.core.models.annotations.Plugin;
8+
import io.kestra.core.models.flows.FlowSource;
89
import io.kestra.core.models.flows.FlowWithSource;
910
import io.kestra.core.models.property.Property;
1011
import io.kestra.core.models.tasks.RunnableTask;
@@ -301,7 +302,7 @@ private void planFlows(RunContext rc, Path baseDir, GitTree gitTree, KestraState
301302
diff.add(DiffLine.added(fileRel, key, Kind.FLOW));
302303
if (!rDryRun) apply.add(() -> {
303304
try {
304-
var flowValidated = fs.validate(rc.flowInfo().tenantId(), gitNode.rawYaml).getFirst();
305+
var flowValidated = fs.validate(rc.flowInfo().tenantId(), List.of(new FlowSource(key, gitNode.rawYaml))).getFirst();
305306

306307
if (flowValidated.getConstraints() != null) {
307308
throw new FlowProcessingException(flowValidated.getConstraints());
@@ -360,7 +361,7 @@ private void planFlows(RunContext rc, Path baseDir, GitTree gitTree, KestraState
360361
diff.add(DiffLine.updatedKestra(fileRel, key, Kind.FLOW));
361362
if (!rDryRun) apply.add(() -> {
362363
try {
363-
var flowValidated = fs.validate(rc.flowInfo().tenantId(), gitNode.rawYaml).getFirst();
364+
var flowValidated = fs.validate(rc.flowInfo().tenantId(), List.of(new FlowSource(key, gitNode.rawYaml))).getFirst();
364365

365366
if (flowValidated.getConstraints() != null) {
366367
throw new FlowProcessingException(flowValidated.getConstraints());

src/main/java/io/kestra/plugin/git/SyncFlows.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
import io.kestra.core.models.annotations.Example;
66
import io.kestra.core.models.annotations.Plugin;
77
import io.kestra.core.models.flows.Flow;
8+
import io.kestra.core.models.flows.FlowSource;
89
import io.kestra.core.models.flows.FlowWithException;
910
import io.kestra.core.models.flows.FlowWithSource;
1011
import io.kestra.core.models.property.Property;
1112
import io.kestra.core.runners.DefaultRunContext;
1213
import io.kestra.core.runners.RunContext;
1314
import io.kestra.core.services.FlowService;
14-
import io.kestra.sdk.KestraClient;
1515
import io.swagger.v3.oas.annotations.media.Schema;
1616
import jakarta.validation.constraints.NotNull;
1717
import lombok.*;
1818
import lombok.experimental.SuperBuilder;
1919
import org.apache.commons.io.IOUtils;
20-
import org.eclipse.jgit.api.Git;
2120

2221
import java.io.IOException;
2322
import java.io.InputStream;
@@ -204,7 +203,7 @@ protected Flow simulateResourceWrite(RunContext runContext, String renderedNames
204203

205204
String flowSource = SyncFlows.replaceNamespace(renderedNamespace, uri, inputStream);
206205

207-
var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), flowSource).getFirst();
206+
var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), List.of(new FlowSource(null, flowSource))).getFirst();
208207

209208
if (flowValidated.getConstraints() != null) {
210209
var ref = uri.getPath();
@@ -245,7 +244,7 @@ protected Flow writeResource(RunContext runContext, String renderedNamespace, UR
245244

246245
String flowSource = SyncFlows.replaceNamespace(renderedNamespace, uri, inputStream);
247246

248-
var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), flowSource).getFirst();
247+
var flowValidated = flowService.validate(runContext.flowInfo().tenantId(), List.of(new FlowSource(null, flowSource))).getFirst();
249248

250249
if (flowValidated.getConstraints() != null) {
251250
var ref = uri.getPath();

0 commit comments

Comments
 (0)