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
질문됨 한 달 전101회 조회
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
전문가
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠