aws-ia / terraform-aws-control_tower_account_factory

AWS Control Tower Account Factory
Apache License 2.0
654 stars 454 forks source link

Show codepipelines status from command line #469

Open hacker65536 opened 5 months ago

hacker65536 commented 5 months ago

Describe the outcome you'd like

I want to easily check the status of codepipelines.

Is your feature request related to a problem you are currently experiencing? If so, please describe.

I use a script like this.

Additional context

function aft-pipeline-status() {

  local acclist="$(
    export AWS_PROFILE=<AWS_MNG_ACCOUNT>
    aws organizations list-accounts --query 'Accounts[?Status==`ACTIVE`].[Id,Name]' --output text | sort | sed -e 's/ /_/'
  )"
  local pipelinelist=("$(
    export AWS_PROFILE=<AWS_AFT_MNG_ACCOUNT>
    aws codepipeline list-pipelines --query 'pipelines[?ends_with(name,`customizations-pipeline`)].name.[@]' --output text
  )")

  local pipelinestats=$(
    export AWS_PROFILE=<AWS_AFT_MNG_ACCOUNT>
    echo "$pipelinelist" | gxargs -n 1 | gxargs -P 10 -I{} bash -c $'printf "%s %s\n" "$(echo \"{}\"| gsed -r -e \'s/([0-9]{12})(.*)/\\1  \\1\\2/\')" "$(aws codepipeline list-pipeline-executions --pipeline-name {} --query \'pipelineExecutionSummaries[0].[pipelineExecutionId,status,lastUpdateTime,sourceRevisions[?actionName==`aft-global-customizations`].actionName|[0],sourceRevisions[?actionName==`aft-global-customizations`].revisionId|[0],sourceRevisions[?actionName==`aft-account-customizations`].actionName|[0],sourceRevisions[?actionName==`aft-account-customizations`].revisionId|[0]]\' --output text)"'

  )
  join -a 1 -e NULL -1 1 -2 1 <(echo "$acclist") <(echo "$pipelinestats" | sort)
}
 aft-pipeline-status |column -t |sort -k 5,5 | grep -E --color=always "$|Succeeded"
snebhu3 commented 5 months ago

@hacker65536 thank you for reaching out. I will create an internal backlog to bring this up to the team for further evaluation.