Skip to content

Commit

Permalink
Add metrics to release actions (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
hozkaya2000 committed Feb 22, 2024
1 parent 6f3a0cd commit e2f7bd5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/initiaterelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,26 @@ jobs:
git add Config
git commit -m "Add config"
git remote add codecommit codecommit::us-west-2://amazon-ecs-ami-mirror
git push codecommit main:shinkansen
git push codecommit main:shinkansen
MetricPublish:
needs: [GenerateConfig, PushToCodeCommit]
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{secrets.AMI_MIRROR_ROLE}}
aws-region: us-west-2
- name: Failure Scenario
if: ${{ needs.GenerateConfig.result == 'failure' || needs.PushToCodeCommit.result == 'failure' }}
run: aws cloudwatch put-metric-data --metric-name EcsAmiGithubActionStatus --namespace ECSAMIRelease --value "-1"
- name: Release Kickoff Scenario
if: ${{ needs.PushToCodeCommit.result == 'success'}}
run: aws cloudwatch put-metric-data --metric-name EcsAmiGithubActionStatus --namespace ECSAMIRelease --value 1
- name: No Release Scenario
if: ${{ needs.GenerateConfig.result == 'success' && needs.PushToCodeCommit.result == 'skipped' }}
run: aws cloudwatch put-metric-data --metric-name EcsAmiGithubActionStatus --namespace ECSAMIRelease --value 0
16 changes: 16 additions & 0 deletions .github/workflows/manualtrigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,19 @@ jobs:
git commit -m "Add config"
git remote add codecommit codecommit::us-west-2://amazon-ecs-ami-mirror
git push codecommit main:shinkansen
MetricPublish:
needs: [PushToCodeCommit]
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{secrets.AMI_MIRROR_ROLE}}
aws-region: us-west-2
- name: Success
if: ${{ needs.PushToCodeCommit.result == 'success' }}
run: aws cloudwatch put-metric-data --metric-name EcsAmiGithubActionStatus --namespace ECSAMIRelease --value 1

0 comments on commit e2f7bd5

Please sign in to comment.