Condition Approval in a Codepipeline, ONLY if there is change in the stage.

0

i have a multi-stage codepipeline, ( created by Cdk code-pipelines ). If a stage has no changes, i'd like for it just to complete..

If there is a change, i'd like for it to have to be approved before it can proceeed.

Is this even possible.?

1 Antwort
1

Is this even possible.?

yes


How?

First. you can create an EventBridge rule that checks if there are any changes to the input artifact(s) before executing the actions in a particular stage. If there are no changes, the EventBridge rule can trigger a custom action that skips the stage and transitions the pipeline to the next stage.

The pseudocode for this approach would look something like this:

FOR EACH STAGE:
    CHECK IF INPUT ARTIFACT HAS CHANGES
    IF INPUT ARTIFACT HAS NO CHANGES:
        TRIGGER EVENTBRIDGE RULE TO SKIP STAGE
    ELSE:
        EXECUTE STAGE ACTIONS

Then, you can add a manual approval action to any stage where you want to require explicit approval before proceeding. Instead of using the built-in manual approval action provided by CodePipeline, you can create an EventBridge rule that sends a notification (e.g., SNS topic or Lambda function) when a stage has changes and requires manual approval.

The pseudocode for this approach would look something like this:

FOR EACH STAGE:
    CHECK IF INPUT ARTIFACT HAS CHANGES
    IF INPUT ARTIFACT HAS CHANGES:
        TRIGGER EVENTBRIDGE RULE TO SEND MANUAL APPROVAL NOTIFICATION
        WAIT FOR MANUAL APPROVAL CONFIRMATION
    EXECUTE STAGE ACTIONS

Finally, the manual approval confirmation can be implemented in various ways, such as:

Key sources:

profile picture
EXPERTE
beantwortet vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen