Sanitize production SMS usage data #583
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sanitize production SMS usage data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 22 * * *" | |
| env: | |
| INPUT_BUCKET_1: notification-canada-ca-production-sms-usage-logs | |
| INPUT_BUCKET_2: notification-canada-ca-production-sms-usage-west-2-logs | |
| ACCOUNT_ID: ${{ secrets.PRODUCTION_AWS_ACCOUNT_ID }} | |
| AWS_DEFAULT_REGION: ca-central-1 | |
| permissions: | |
| id-token: write # This is required for requesting the OIDC JWT | |
| contents: write # This is required for actions/checkout | |
| pull-requests: write | |
| jobs: | |
| sanitize-sms-usage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Checkout | |
| uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
| - name: Install python packages | |
| run: pip install -r ./scripts/sanitize_sms_usage_logs/requirements.txt | |
| - name: Configure credentials to Notify using OIDC | |
| uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0 | |
| with: | |
| role-to-assume: arn:aws:iam::${{env.ACCOUNT_ID}}:role/notification-terraform-apply | |
| role-session-name: NotifyTerraformApply | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: run script | |
| run: | | |
| python ./scripts/sanitize_sms_usage_logs/sanitize_sms_usage_logs.py ${INPUT_BUCKET_1} ${INPUT_BUCKET_1}-san --push | |
| python ./scripts/sanitize_sms_usage_logs/sanitize_sms_usage_logs.py ${INPUT_BUCKET_2} ${INPUT_BUCKET_2}-san --push | |
| - name: Notify Slack channel if this job failed | |
| if: ${{ failure() }} | |
| run: | | |
| json='{"text":"<!here> Sanitize production SMS usage data failed in <https://github.com/cds-snc/notification-terraform/|notification-terraform> !"}' | |
| curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.NOTIFY_DEV_SLACK_WEBHOOK }} |