-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Deleting Stage with invalid cluster configuration (#10)
Change-Id: Ic2d0fe7c09510b2e92f702fdbdf39493e06eb29f
- Loading branch information
Showing
45 changed files
with
324 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package chain | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
ctrl "sigs.k8s.io/controller-runtime" | ||
|
||
cdPipeApi "github.com/epam/edp-cd-pipeline-operator/v2/api/v1" | ||
"github.com/epam/edp-cd-pipeline-operator/v2/controllers/stage/chain/handler" | ||
) | ||
|
||
type chain struct { | ||
handlers []handler.CdStageHandler | ||
} | ||
|
||
func (ch *chain) Use(handlers ...handler.CdStageHandler) { | ||
ch.handlers = append(ch.handlers, handlers...) | ||
} | ||
|
||
func (ch *chain) ServeRequest(ctx context.Context, stage *cdPipeApi.Stage) error { | ||
log := ctrl.LoggerFrom(ctx) | ||
|
||
log.Info("Starting Stage chain") | ||
|
||
for i := 0; i < len(ch.handlers); i++ { | ||
h := ch.handlers[i] | ||
|
||
err := h.ServeRequest(ctx, stage) | ||
if err != nil { | ||
return fmt.Errorf("failed to serve handler: %w", err) | ||
} | ||
} | ||
|
||
log.Info("Handling of Stage has been finished") | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.