Skip to content

Commit

Permalink
fix(tasks): rename Reconcile task to Sync task
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Jan 3, 2024
1 parent 12fdaad commit ceeb759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@
@Getter
@NoArgsConstructor
@Schema(
title = "Reconcile the code for namespace files and flows based on the current state in Git.",
title = "Synchronizes the code for namespace files and flows based on the current state in Git.",
description = "Files located in `gitDirectory` will be added/modified in namespace files under `namespaceFilesDirectory` folder. " +
"Any file not present in the `gitDirectory` but present in `namespaceFilesDirectory` will be deleted from namespace files to ensure that Git remains a single source of truth for your workflow and application code. " +
"If there is a `_flows` folder under the `gitDirectory` folder, any file within it will be parsed and imported as a flow under the namespace declared in the task (namespace defined in the flow code might get overwritten if it's not equal to the namespace or child namespace defined in this task)."
)
@Plugin(
examples = {
@Example(
title = "Reconcile namespace files & flows based on the current state in a Git repository. This flow can be triggered either on a schedule or anytime you push a change to a given Git branch.",
title = "Synchronizes namespace files & flows based on the current state in a Git repository. This flow can be triggered either on a schedule or anytime you push a change to a given Git branch.",
full = true,
code = {
"id: sync_from_git",
"namespace: prod",
"",
"tasks:",
" - id: git",
" type: io.kestra.plugin.git.Reconcile",
" type: io.kestra.plugin.git.Sync",
" url: https://github.com/kestra-io/scripts",
" branch: main",
" username: anna-geller",
Expand All @@ -75,7 +75,7 @@
)
}
)
public class Reconcile extends AbstractGitTask implements RunnableTask<VoidOutput> {
public class Sync extends AbstractGitTask implements RunnableTask<VoidOutput> {
public static final String FLOWS_DIRECTORY = "_flows";
public static final Pattern NAMESPACE_FINDER_PATTERN = Pattern.compile("(?m)^namespace: (.*)$");
public static final Pattern FLOW_ID_FINDER_PATTERN = Pattern.compile("(?m)^id: (.*)$");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import static org.hamcrest.Matchers.is;

@MicronautTest
class ReconcileTest {
class SyncTest {
public static final String BRANCH = "reconcile";
public static final String NAMESPACE = "my.namespace";
public static final String TENANT_ID = "my-tenant";
Expand Down Expand Up @@ -164,7 +164,7 @@ void reconcileNsFilesAndFlows() throws Exception {

// region WHEN
String clonedGitDirectory = "to_clone";
Reconcile task = Reconcile.builder()
Sync task = Sync.builder()
.url("https://github.com/kestra-io/unit-tests")
.username(pat)
.password(pat)
Expand Down Expand Up @@ -263,7 +263,7 @@ void reconcile_MinimumSetup() throws Exception {
);

// region WHEN
Reconcile task = Reconcile.builder()
Sync task = Sync.builder()
.url("https://github.com/kestra-io/unit-tests")
.username(pat)
.password(pat)
Expand Down Expand Up @@ -305,7 +305,7 @@ void reconcile_MinimumSetup() throws Exception {
void reconcile_DryRun_ShouldDoNothing() throws Exception {
List<LogEntry> logs = new ArrayList<>();
logQueue.receive(l -> logs.add(l.getLeft()));
String namespace = ReconcileTest.class.getName().toLowerCase();
String namespace = SyncTest.class.getName().toLowerCase();

String flowSource = """
id: some-flow
Expand All @@ -329,7 +329,7 @@ void reconcile_DryRun_ShouldDoNothing() throws Exception {
flow
);

flow = flow.toBuilder().id("sub-namespace-flow").namespace(ReconcileTest.class.getName().toLowerCase() + ".sub").build();
flow = flow.toBuilder().id("sub-namespace-flow").namespace(SyncTest.class.getName().toLowerCase() + ".sub").build();
flowRepositoryInterface.create(
flow,
flowSource.replace("some-flow", "sub-namespace-flow"),
Expand All @@ -355,9 +355,9 @@ void reconcile_DryRun_ShouldDoNothing() throws Exception {
new ByteArrayInputStream(someFileContent.getBytes())
);

Reconcile task = Reconcile.builder()
Sync task = Sync.builder()
.id("reconcile")
.type(Reconcile.class.getName())
.type(Sync.class.getName())
.url("https://github.com/kestra-io/unit-tests")
.username(pat)
.password(pat)
Expand Down

0 comments on commit ceeb759

Please sign in to comment.