From 154ddecb25eb1b10511604baac2ec282f4f70639 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Thu, 19 Sep 2024 15:21:23 +0200 Subject: [PATCH] WIP. Rename Konflux Pipeleines class to KonfluxProvider Signed-off-by: cmoulliard --- .../dev/snowdrop/factory/WorkflowBuilder.java | 3 ++- .../Pipelines.java => KonfluxProvider.java} | 6 ++--- .../factory/tekton/PipelineRunBuilder.java | 22 +++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) rename src/main/java/dev/snowdrop/factory/konflux/{pipeline/Pipelines.java => KonfluxProvider.java} (99%) diff --git a/src/main/java/dev/snowdrop/factory/WorkflowBuilder.java b/src/main/java/dev/snowdrop/factory/WorkflowBuilder.java index 38b3cd1..0d73e6d 100644 --- a/src/main/java/dev/snowdrop/factory/WorkflowBuilder.java +++ b/src/main/java/dev/snowdrop/factory/WorkflowBuilder.java @@ -1,5 +1,6 @@ package dev.snowdrop.factory; +import dev.snowdrop.factory.konflux.KonfluxProvider; import dev.snowdrop.factory.tekton.TektonProvider; public class WorkflowBuilder { @@ -11,7 +12,7 @@ public Builder withProvider(Type providerType) { private static Provider createProvider(String provider) { switch (provider.toUpperCase()) { case "KONFLUX": - return new dev.snowdrop.factory.konflux.pipeline.Pipelines(); + return new KonfluxProvider(); case "TEKTON": return new TektonProvider(); default: diff --git a/src/main/java/dev/snowdrop/factory/konflux/pipeline/Pipelines.java b/src/main/java/dev/snowdrop/factory/konflux/KonfluxProvider.java similarity index 99% rename from src/main/java/dev/snowdrop/factory/konflux/pipeline/Pipelines.java rename to src/main/java/dev/snowdrop/factory/konflux/KonfluxProvider.java index 599c846..01f5b1f 100644 --- a/src/main/java/dev/snowdrop/factory/konflux/pipeline/Pipelines.java +++ b/src/main/java/dev/snowdrop/factory/konflux/KonfluxProvider.java @@ -1,4 +1,4 @@ -package dev.snowdrop.factory.konflux.pipeline; +package dev.snowdrop.factory.konflux; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; @@ -30,9 +30,9 @@ import static dev.snowdrop.service.RemoteTaskSvc.BUNDLE_PREFIX; import static dev.snowdrop.service.RemoteTaskSvc.fetchExtractTask; -public class Pipelines implements Provider { +public class KonfluxProvider implements Provider { - private static final Logger logger = LoggerFactory.getLogger(Pipelines.class); + private static final Logger logger = LoggerFactory.getLogger(KonfluxProvider.class); private static Type TYPE = null; private static final String BUILD_TASK_NAME = "build-container"; diff --git a/src/main/java/dev/snowdrop/factory/tekton/PipelineRunBuilder.java b/src/main/java/dev/snowdrop/factory/tekton/PipelineRunBuilder.java index 7a33041..7e9ebc8 100644 --- a/src/main/java/dev/snowdrop/factory/tekton/PipelineRunBuilder.java +++ b/src/main/java/dev/snowdrop/factory/tekton/PipelineRunBuilder.java @@ -15,19 +15,19 @@ public static PipelineRun generatePipelineRun(Type TYPE, Configurator cfg, List< // @formatter:off PipelineRun pipelineRun = new io.fabric8.tekton.pipeline.v1.PipelineRunBuilder() .withNewMetadata() - .withName(cfg.getJob().getName()) - .withLabels(LabelsProviderFactory.getProvider(TYPE).getPipelineLabels(cfg)) - .withAnnotations(AnnotationsProviderFactory.getProvider(TYPE).getPipelineAnnotations(cfg)) - .withNamespace(cfg.getNamespace()) + .withName(cfg.getJob().getName()) + .withLabels(LabelsProviderFactory.getProvider(TYPE).getPipelineLabels(cfg)) + .withAnnotations(AnnotationsProviderFactory.getProvider(TYPE).getPipelineAnnotations(cfg)) + .withNamespace(cfg.getNamespace()) .endMetadata() .withNewSpec() - .withParams(params) - .withWorkspaces(pipelineWorkspaces) - .withTimeouts(populateTimeOut(cfg.getJob().getTimeout())) - .withNewPipelineSpec() - .withResults(pipelineResults) - .withTasks(tasks) - .endPipelineSpec() + .withParams(params) + .withWorkspaces(pipelineWorkspaces) + .withTimeouts(populateTimeOut(cfg.getJob().getTimeout())) + .withNewPipelineSpec() + .withResults(pipelineResults) + .withTasks(tasks) + .endPipelineSpec() .endSpec() .build(); // @formatter:on