Skip to content

Commit

Permalink
Merge default labels, annotations with the generated
Browse files Browse the repository at this point in the history
Signed-off-by: cmoulliard <[email protected]>
  • Loading branch information
cmoulliard committed Sep 6, 2024
1 parent 1760f01 commit 4a60b3c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/dev/snowdrop/factory/konflux/pipeline/Pipelines.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,20 @@ public HasMetadata generatePipeline(Configurator cfg) {
return new PipelineRunBuilder()
.withNewMetadata()
.withName(cfg.getJob().getName()) // User's job name
.withLabels(generateLabels(cfg)) // Calculate new labels using Application/Component name, domain, etc.
.withAnnotations(generateAnnotations(cfg)) // Create the annotation build.appstudio.openshift.io/repo
.addToLabels(
Stream.concat(defaultPipelineRun.getMetadata().getLabels().entrySet().stream(),generateLabels(cfg).entrySet().stream())
.collect(Collectors.toMap(
Map.Entry::getKey, // Key mapper
Map.Entry::getValue, // Value mapper
(v1, v2) -> v1 + v2))
) // Merge calculated new labels (based on Application/Component name, domain, etc.) with defaults
.addToAnnotations(
Stream.concat(defaultPipelineRun.getMetadata().getAnnotations().entrySet().stream(),generateAnnotations(cfg).entrySet().stream())
.collect(Collectors.toMap(
Map.Entry::getKey, // Key mapper
Map.Entry::getValue, // Value mapper
(v1, v2) -> v1 + v2))
) // Merge calculated new annotation generated: build.appstudio.openshift.io/repo with defaults
.withNamespace(cfg.getNamespace()) // User's namespace
.endMetadata()
.withNewSpec()
Expand Down

0 comments on commit 4a60b3c

Please sign in to comment.