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.?

profile picture
已提問 1 個月前檢視次數 102 次
1 個回答
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
專家
已回答 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南