Skip to content

Commit

Permalink
chore:
Browse files Browse the repository at this point in the history
1. improved workflow to not trigger the main merge if PR is just closed, only trigger when code is merged to main.
2. added extra logging to prisma , for logging params and query execution time.

Signed-off-by: Sukanya Rath <sukanyarath1987@gmail.com>
  • Loading branch information
sukanya-rath committed Dec 21, 2023
1 parent 87eb3ae commit 61d6fe0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 26 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/cd-to-dev-on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,39 @@ name: Merge to Main
env:
deployment_name: pay-transparency
on:
workflow_run:
workflows: [ "Pull Request Closed" ]
types:
- completed
push:
branches: [main]
paths-ignore:
- '*.md'
- 'docker-compose.yml'
- 'renovate.json'
- 'COMPLIANCE.yaml'
- '.gitignore'
- '.vscode/**'
- '.diagrams/**'
- '.graphics/**'
workflow_dispatch:
inputs:
pr_no:
description: "PR-numbered container set to deploy"
type: number
required: true

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
vars:
name: Set Variables
outputs:
pr: ${{ steps.pr.outputs.pr }}
runs-on: ubuntu-22.04
timeout-minutes: 1
steps: # Get PR number for squash merges to main
- name: PR Number
id: pr
uses: bcgov-nr/action-get-pr@v0.0.1
codeql:
name: Semantic Code Analysis
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -57,7 +79,7 @@ jobs:
skip-on-empty: 'false'
git-push: 'true'
retag-images:
needs: [ semantic-version ]
needs: [ vars, semantic-version ]
runs-on: ubuntu-22.04
strategy:
matrix:
Expand All @@ -68,8 +90,10 @@ jobs:
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: dev
tags: ${{ needs.semantic-version.outputs.semanticVersion }}
target: ${{ needs.vars.outputs.pr }}
tags: |
${{ needs.semantic-version.outputs.semanticVersion }}
dev
deploys:
name: Deploys (dev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,3 @@ jobs:
helm status ${{ env.release }} && helm uninstall --no-hooks ${{ env.release }} || \
echo "Not found: ${{ env.release }}"
# If merged into main, then handle any image promotions
image-promotions:
name: Image Promotions
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
package: [backend, database, database-migrations, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ github.event.number }}
tags: |
dev
${{ github.sha }}
5 changes: 5 additions & 0 deletions backend/src/v1/prisma/prisma-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if (!prisma) {
errorFormat: 'pretty',
datasourceUrl: datasourceUrl
});
// @ts-expect-error, this is a prisma thing.
prisma.$on('query', (e) => {
// @ts-expect-error, this is a prisma thing.
logger.info(`Params: ${e.params} \n Duration: ${e.duration}ms`);
});
}

export default prisma;

0 comments on commit 61d6fe0

Please sign in to comment.