Skip to content

Commit

Permalink
SIMSBIOHUB-331: Keycloak Library Updates (#1151)
Browse files Browse the repository at this point in the history
* Swap out old keycloak libraries for newer more up to date libraries.
* Add RouteGuards tests.
* Add git action to clean PR builds for PRs against non-base branches
  • Loading branch information
NickPhura authored Nov 2, 2023
1 parent 18a5f28 commit 2876f50
Show file tree
Hide file tree
Showing 70 changed files with 2,366 additions and 2,098 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/cleanClosedPR.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Clean out all deployment artifacts when a PR is closed, but not merged.
# Will attempt to remove all artifacts from any PR that was opened against any branch (and then closed (not merged)), except for test and prod.
# Will attempt to remove all artifacts from any PR that was opened against any branch (and then closed (not merged)).
name: Clean Closed PR Artifacts

on:
pull_request:
types: [closed]
branches-ignore:
- test
- prod

jobs:
clean:
name: Clean Deployment Artifacts for API and App in Dev and Tools environment
runs-on: ubuntu-latest
timeout-minutes: 20
# Don't run if the PR was merged
if: ${{ github.event.pull_request.merged != true }}
env:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/cleanMergedPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Clean out all deployment artifacts when a PR is merged against a non-standard base branch (aka: neither dev, test, or prod)
# Standard branches (aka: dev, test, prod) have their own cleanup routine that runs as part of the deployStatic action.
name: Clean Merged PR Artifacts

on:
pull_request:
types: [closed]
branches-ignore:
- dev
- test
- prod

jobs:
clean:
name: Clean Deployment Artifacts for API and App in Dev and Tools environment
runs-on: ubuntu-latest
timeout-minutes: 20
# Only run if the PR was merged
if: ${{ github.event.pull_request.merged == true }}
env:
PR_NUMBER: ${{ github.event.number }}
steps:
# Install Node - for `node` and `npm` commands
# Note: This already uses actions/cache internally, so repeat calls in subsequent jobs are not a performance hit
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14

# Load repo from cache
- name: Cache repo
uses: actions/cache@v3
id: cache-repo
env:
cache-name: cache-repo
with:
path: ${{ github.workspace }}/*
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}

# Checkout the branch if not restored via cache
- name: Checkout Target Branch
if: steps.cache-repo.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
persist-credentials: false

# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: Log in to OpenShift
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443

# Clean the app deployment artifacts
- name: Clean APP Deployment
working-directory: "app/.pipeline/"
run: |
npm ci
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=build
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=dev
# Clean the database build/deployment artifacts
- name: Clean Database Artifacts
working-directory: "database/.pipeline/"
run: |
npm ci
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=build
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=dev
# Clean the api deployment artifacts
- name: Clean API Deployment
working-directory: "api/.pipeline/"
run: |
npm ci
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=build
DEBUG=* npm run clean -- --pr=$PR_NUMBER --env=dev
# Clean the reamaining build/deployment artifacts
- name: Clean remaining Artifacts
env:
POD_SELECTOR: biohubbc
run: |
oc --namespace af2668-dev get all,pvc,secret,pods,ReplicationController,DeploymentConfig,HorizontalPodAutoscaler,imagestreamtag -o name | grep $POD_SELECTOR | grep $PR_NUMBER | awk '{print "oc delete --ignore-not-found " $1}' | bash
oc --namespace af2668-tools get all,pvc,secret,pods,ReplicationController,DeploymentConfig,HorizontalPodAutoscaler,imagestreamtag -o name | grep $POD_SELECTOR | grep $PR_NUMBER | awk '{print "oc delete --ignore-not-found " $1}' | bash
12 changes: 6 additions & 6 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"lint": "eslint . --ignore-pattern 'node_modules' --ext .ts",
"lint-fix": "eslint . --fix --ignore-pattern 'node_modules' --ext .ts",
"format": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,css,scss}\"",
"format-fix": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,json,css,scss}\""
"format-fix": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,json,css,scss}\"",
"fix": "npm-run-all -l -s lint-fix format-fix"
},
"engines": {
"node": ">= 14.0.0",
Expand Down Expand Up @@ -97,7 +98,7 @@
"gulp-typescript": "~5.0.1",
"mocha": "~8.4.0",
"nodemon": "~2.0.14",
"npm-run-all": "~4.1.5",
"npm-run-all": "^4.1.5",
"nyc": "~15.1.0",
"prettier": "~2.2.1",
"prettier-plugin-organize-imports": "~2.3.4",
Expand Down
4 changes: 2 additions & 2 deletions api/src/repositories/administrative-activity-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class AdministrativeActivityRepository extends BaseRepository {
ON
aa.administrative_activity_status_type_id = aast.administrative_activity_status_type_id
WHERE
(aa.data -> 'userGuid')::text = '"' || ${userGUID} || '"'
LOWER(aa.data ->> 'userGuid') = LOWER(${userGUID})
AND
aast.name = 'Pending'
),
Expand All @@ -217,7 +217,7 @@ export class AdministrativeActivityRepository extends BaseRepository {
ON
pp.system_user_id = su.system_user_id
WHERE
su.user_guid = ${userGUID}
LOWER(su.user_guid) = LOWER(${userGUID})
) SELECT
*
FROM
Expand Down
2 changes: 1 addition & 1 deletion api/src/repositories/user-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class UserRepository extends BaseRepository {
ON
uis.user_identity_source_id = su.user_identity_source_id
WHERE
su.user_guid = ${userGuid}
LOWER(su.user_guid) = LOWER(${userGuid})
GROUP BY
su.system_user_id,
su.record_end_date,
Expand Down
Loading

0 comments on commit 2876f50

Please sign in to comment.