Skip to content

feat : instrument data access audit logs (M2-10700) #1913

feat : instrument data access audit logs (M2-10700)

feat : instrument data access audit logs (M2-10700) #1913

Workflow file for this run

name: Preview and Test PR
on:
pull_request:
types:
- opened
- reopened
- synchronize
# Only run the latest. Cancel old runs in progress.
concurrency:
cancel-in-progress: true
group: "preview-env-manage-${{ github.event.number }}"
jobs:
# create-database:
# name: Create preview env DB
# uses: ChildMindInstitute/mindlogger-backend-refactor/.github/workflows/create_db.yaml@develop
# with:
# db-name: "mindlogger_backend_pr_${{ github.event.number }}"
# secrets: inherit
#
# on-db-failure:
# name: Database creation failed
# runs-on: ubuntu-latest
# if: ${{ always() && (needs.create_database.result == 'failure' || needs.create_database.result == 'timed_out') }}
# needs: [create-database]
# steps:
# - name: "Send Slack message on failure"
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_COLOR: failure
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TEST_RESULTS }}
# SLACK_TITLE: Create Database
# SLACK_MESSAGE: 'Error during database creation!'
# SLACK_ICON: https://github.com/github.png?size=48
# MSG_MINIMAL: actions url
run-unit-tests:
uses: ./.github/workflows/tests.yaml
secrets: inherit
comment-unit-tests:
name: Comment on unit test outcome
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
statuses: write
needs: [ run-unit-tests ]
steps:
# - name: Post the link to the report
# uses: guibranco/github-status-action-v2@v1
# with:
# authToken: ${{secrets.GITHUB_TOKEN}}
# context: 'Unit Test report'
# state: ${{ needs.run-unit-tests.result }}
# sha: ${{ github.event.pull_request.head.sha }}
# target_url: ${{ needs.run-unit-tests.outputs.report-url }}
- name: "Send Slack message on failure"
if: ${{ needs.run-unit-tests.result != 'success' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: failure
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TEST_RESULTS }}
SLACKIFY_MARKDOWN: true
SLACK_TITLE: |
:rotating_light: Unit test suite failed
SLACK_MESSAGE: >-
Unit tests for PR-${{ github.event.pull_request.number}} failed in ${{ github.repository }}
\n\n
:arrow_right: [Action Run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
\n\n
:label: [Pull Request](${{ github.event.pull_request.html_url || github.event.head_commit.url }}) | :chart_with_upwards_trend: [Test Report](${{ needs.run-unit-tests.outputs.report-url }})
SLACK_ICON: https://github.com/github.png?size=48
MSG_MINIMAL: true
# create-preview-env:
# needs: [create-database, run-unit-tests]
# uses: ChildMindInstitute/mindlogger-backend-refactor/.github/workflows/create-preview-env.yaml@develop
# with:
# env-name: "pr-${{ github.event.number }}"
# env-snake-name: "pr_${{ github.event.number }}"
# app-name: ${{ github.event.repository.name }}
# vpc-id: vpc-0a83201b71e854abd
# copilot-service: mindlogger-backend
# secrets: inherit
#
# comment-create-preview-env:
# name: Comment on preview env
# runs-on: ubuntu-latest
# permissions:
# issues: write
# pull-requests: write
# needs: [create-preview-env]
# if: ${{ !cancelled() }}
# steps:
# - name: Comment on PR
# uses: thollander/actions-comment-pull-request@v2
# with:
# message: |
# :arrow_right: Preview environment created: [Click Me!](${{ needs.create-preview-env.outputs.service-url }})
# reactions: eyes, rocket
# comment_tag: service-url
# - name: "Send Slack message on failure"
# uses: rtCamp/action-slack-notify@v2
# if: ${{ !cancelled() && needs.create-preview-env.result == 'failure' }}
# env:
# SLACK_COLOR: failure
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TEST_RESULTS }}
# SLACKIFY_MARKDOWN: true
# SLACK_TITLE: |
# :rotating_light: Preview Environment Failed
# SLACK_MESSAGE: >-
# Failed to create a preview env for PR-${{ github.event.pull_request.number}} in ${{ github.repository }}
# \n\n
# :arrow_right: [Action Run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
# \n\n
# :label: [Pull Request](${{ github.event.pull_request.html_url || github.event.head_commit.url }})
# MSG_MINIMAL: true
# Might do this in the future
# docker-scan:
# runs-on: ubuntu-latest
# needs: create-preview-env
# permissions:
# id-token: write
# steps:
# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v6
# with:
# role-to-assume: arn:aws:iam::992382368072:role/cmiml-feature-oidc-github-role
# role-session-name: gha-oidc-runner
# aws-region: us-east-1
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/trivy-action@0.28.0
# with:
# image-ref: '992382368072.dkr.ecr.us-east-1.amazonaws.com/mindlogger-backend-refactor/mindlogger-backend:latest'
# format: 'table'
# exit-code: '1'
# ignore-unfixed: true
# vuln-type: 'os,library'
# severity: 'CRITICAL,HIGH'