Skip to content

Commit a9d1b7d

Browse files
gbenhaimzakisk
authored andcommitted
fix: Annotate PLR when when started status is reported (openshift-pipelines#2208)
* fix: Annotate PLR when started status is reported The use of the state label (which is mutable) for deciding when to report to the SCM that the PLR was started is flaky. It was seen that the reconciler get events about PLRs with unexpected value for the state label. For example, after the status is reported to the SCM, and the label value is patched to "started", after serval reconcile iterations the label had the "queued" value again. This can happen because of unsafe patching done by controllers (not just the PAC controllers) which reconciles PLRs. Introduce a new annotation for indicating the the status was reported to the SCM. By adding an annotation which is set once, we remove the risk that its value will get overwritten by other controllers (since maps are merged when patched, values are not getting removed unless explicitly defined in the patch - https://datatracker.ietf.org/doc/html/rfc7386#section-2) In addition, at the start of each reconcile loop, ensure that we operate on the latest version of the PLR and not using a stale value from the cache. Assisted-By: Cursor Signed-off-by: Gal Ben Haim <[email protected]>
1 parent 542f1a0 commit a9d1b7d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ from your source code repository.
1414

1515
---
1616

17+
Why are you adding this line?
18+
1719
## 🚀 Introduction
1820

1921
Pipelines-as-Code follows the [Pipelines-as-Code

pkg/pipelineascode/pipelineascode.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ func getMergePatch(annotations, labels map[string]string) map[string]any {
310310
}
311311
}
312312

313+
// getExecutionOrderPatch returns a patch to set the execution order of the pipelineRun
314+
// the order is a comma separated list of pipelineRun names
315+
// the order is used to determine the order in which the pipelineRuns are executed
316+
// the order is set in the metadata.annotations.execution-order annotation
317+
// the order is used to determine the order in which the pipelineRuns are executed.
313318
func getExecutionOrderPatch(order string) map[string]any {
314319
return map[string]any{
315320
"metadata": map[string]any{

0 commit comments

Comments
 (0)