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回答
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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ