Skip to content

Commit

Permalink
Add parameter checker script
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Aug 15, 2023
1 parent 9ba8144 commit 4453e27
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/check-code-freshness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,26 @@ jobs:
aws-region: us-west-2
role-to-assume: arn:aws:iam::561178107736:role/DevOps-GitHubOidcFederatedRole
role-session-name: GitHubActions-CheckCodeFreshness
- name: Deploy CloudFormation stack
working-directory: devops
- name: Check parameter ages
run: |
threshold=$(date --date="90 days ago" +%FT%H:%M:%SZ)
echo $threshold
aws_command="aws ssm describe-parameters --profile prx-legacy --parameter-filters Key=Name,Option=Contains,Values=pkg"
unset NEXT_TOKEN
function process_parameter {
echo $1 | jq '.Name'
}
function parse_output() {
if [ ! -z "$cli_output" ]; then
echo $cli_output | jq -c --arg d "$threshold" '.Parameters[] | select( .Name | contains("/prx/prod/Spire/")) | select(.LastModifiedDate < $d)' | while read param; do
process_parameter $param
done
NEXT_TOKEN=$(echo $cli_output | jq -r ".NextToken")
fi
}
# The command is run and output parsed in the below statements.
cli_output=$($aws_command)
parse_output

0 comments on commit 4453e27

Please sign in to comment.