Skip to content

Commit

Permalink
fix(stoneintg-971): reconciliation invalid image digest err
Browse files Browse the repository at this point in the history
stop reconciliation when creating snapshot meets invalid digest err

Signed-off-by: jcullina <[email protected]>
  • Loading branch information
jencull authored and dirgim committed Aug 29, 2024
1 parent 9286047 commit 7a31051
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions internal/controller/buildpipeline/buildpipeline_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ func (a *Adapter) EnsureSnapshotExists() (result controller.OperationResult, err

expectedSnapshot, err := a.prepareSnapshotForPipelineRun(a.pipelineRun, a.component, a.application)
if err != nil {
result, err = a.updatePipelineRunWithCustomizedError(&canRemoveFinalizer, err, a.context, a.pipelineRun, a.client, a.logger)
return controller.RequeueWithError(err)
return a.updatePipelineRunWithCustomizedError(&canRemoveFinalizer, err, a.context, a.pipelineRun, a.client, a.logger)
}

err = a.client.Create(a.context, expectedSnapshot)
Expand Down Expand Up @@ -361,7 +360,7 @@ func (a *Adapter) updatePipelineRunWithCustomizedError(canRemoveFinalizer *bool,
}
logger.Error(cerr, "Build PipelineRun failed with error, should be fixed and re-run manually", "pipelineRun.Name", pipelineRun.Name)
*canRemoveFinalizer = true
return controller.ContinueProcessing()
return controller.StopProcessing()
}
return controller.RequeueOnErrorOrContinue(cerr)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ var _ = Describe("Pipeline Adapter", Ordered, func() {
Expect(helpers.IsInvalidImageDigestError(err)).To(BeTrue())
Eventually(func() bool {
result, err := adapter.EnsureSnapshotExists()
return !result.CancelRequest && err == nil
return result.CancelRequest && err == nil
}, time.Second*10).Should(BeTrue())
Expect(adapter.pipelineRun.GetAnnotations()[helpers.CreateSnapshotAnnotationName]).ToNot(BeNil())
var info map[string]string
Expand Down Expand Up @@ -1005,7 +1005,7 @@ var _ = Describe("Pipeline Adapter", Ordered, func() {

Eventually(func() bool {
result, err := adapter.EnsureSnapshotExists()
return !result.CancelRequest && err == nil
return result.CancelRequest && err == nil
}, time.Second*10).Should(BeTrue())
// Ensure the PLR on the control plane does not have finalizer
Eventually(func() bool {
Expand Down

0 comments on commit 7a31051

Please sign in to comment.