codepipeline stage status

Photo by T K on Unsplash

codepipeline stage status

etc/scripts

  • outline

Script that checks status of Codepipeline stage.

  • script
#!/bin/bash
echo "CodePipeline Deploy Status"
for i in {0..2};
do
        for codepipeline in $(aws codepipeline list-pipelines --query pipelines[].name --output text)
        do
        stage=$(aws codepipeline get-pipeline-state --name $codepipeline --query 'stageStates[].latestExecution[].status | '[$i]'' --output text)
        if [[ $stage == "Succeeded" ]] || [[ $stage == "None" ]]
                then true
        else
                echo check $codepipeline
        fi
        done
done
echo "======================================================================================================================="

** Codepipeline stage : source -> build -> deploy

** None : No stage (ex. SPA or S3 without deployment)