Skip to content

Commit

Permalink
feat: report deploy metrics to Sentinel (#1392)
Browse files Browse the repository at this point in the history
Update the infrastructure and container workflows to
report deployments to Sentinel.
  • Loading branch information
patheard authored Aug 31, 2023
1 parent 0bcba56 commit ecdf528
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/deploy-production-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ jobs:
needs.environments-manifest.outputs.CONTAINER_DEPLOYMENT == 'production'
env:
APACHE_VERSION: ${{ needs.environments-manifest.outputs.PROD_APACHE }}
TARGET_VERSION: ${{ needs.environments-manifest.outputs.PROD_INFRASTRUCTURE }}
WORDPRESS_VERSION: ${{ needs.environments-manifest.outputs.PROD_WORDPRESS }}

steps:
- name: Checkout
Expand All @@ -105,3 +107,12 @@ jobs:
- name: Terragrunt apply ecs
working-directory: infrastructure/terragrunt/env/prod/ecs
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Report deployment to Sentinel
if: always()
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "articles", "sha": "${{ github.sha }}", "version": "Apache ${{ env.APACHE_VERSION }}, Wordpress ${{ env.WORDPRESS_VERSION }}", "repository": "${{ github.repository }}", "environment": "production", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
13 changes: 13 additions & 0 deletions .github/workflows/deploy-staging-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ jobs:
github.event_name == 'push' &&
needs.environments-manifest.outputs.CONTAINER_DEPLOYMENT == 'staging'
env:
APACHE_VERSION: ${{ needs.environments-manifest.outputs.STAG_APACHE }}
WORDPRESS_VERSION: ${{ needs.environments-manifest.outputs.STAG_WORDPRESS }}

steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
Expand All @@ -96,3 +100,12 @@ jobs:
- name: Terragrunt apply ecs
working-directory: infrastructure/terragrunt/env/staging/ecs
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Report deployment to Sentinel
if: always()
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "articles", "sha": "${{ github.sha }}", "version": "Apache ${{ env.APACHE_VERSION }}, Wordpress ${{ env.WORDPRESS_VERSION }}", "repository": "${{ github.repository }}", "environment": "staging", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
11 changes: 10 additions & 1 deletion .github/workflows/terragrunt-apply-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,13 @@ jobs:
- name: Terragrunt apply alarms
if: ${{ steps.filter.outputs.alarms == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: infrastructure/terragrunt/env/prod/alarms
run: terragrunt apply --terragrunt-non-interactive -auto-approve
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Report deployment to Sentinel
if: always()
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "articles", "sha": "${{ github.sha }}", "version": "Infrastructure ${{ env.TARGET_VERSION }}", "repository": "${{ github.repository }}", "environment": "production", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}
9 changes: 9 additions & 0 deletions .github/workflows/terragrunt-apply-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,12 @@ jobs:
if: ${{ steps.filter.outputs.alarms == 'true' || steps.filter.outputs.common == 'true' }}
working-directory: infrastructure/terragrunt/env/staging/alarms
run: terragrunt apply --terragrunt-non-interactive -auto-approve

- name: Report deployment to Sentinel
if: always()
uses: cds-snc/sentinel-forward-data-action@main
with:
input_data: '{"product": "articles", "sha": "${{ github.sha }}", "version": "Infrastructure ${{ github.sha }}", "repository": "${{ github.repository }}", "environment": "staging", "status": "${{ job.status }}"}'
log_type: CDS_Product_Deployment_Data
log_analytics_workspace_id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }}
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}

0 comments on commit ecdf528

Please sign in to comment.