Skip to content

Commit

Permalink
feat: Release/noble sea lemon (#733)
Browse files Browse the repository at this point in the history
Signed-off-by: OMPRAKASH MISHRA <[email protected]>
Co-authored-by: Josh Gamache <[email protected]>
Co-authored-by: gregorylavery <[email protected]>
Co-authored-by: Barrett Falk <[email protected]>
Co-authored-by: dmitri-korin-bcps <[email protected]>
Co-authored-by: Scarlett <[email protected]>
Co-authored-by: Mike <[email protected]>
Co-authored-by: Mike Sears <[email protected]>
Co-authored-by: jeznorth <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Scarlett <[email protected]>
Co-authored-by: Ryan Rondeau <[email protected]>
Co-authored-by: jon-funk <[email protected]>
Co-authored-by: Mike Vesprini <[email protected]>
Co-authored-by: Om Mishra <[email protected]>
Co-authored-by: Mike Vesprini <[email protected]>
  • Loading branch information
16 people authored Nov 4, 2024
1 parent 4f34914 commit 019eab5
Show file tree
Hide file tree
Showing 130 changed files with 5,237 additions and 995 deletions.
39 changes: 39 additions & 0 deletions .github/actions/get-latest-pr-number/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Get Latest Merged PR Number
description: Get the latest merged PR number from the release branch, this is the production candidate
branding:
icon: git-pull-request
color: blue

inputs:
token:
description: Specify token (GH or PAT), instead of inheriting one from the calling workflow
default: ${{ github.token }}

outputs:
pr:
description: "Latest merged pull request number"
value: ${{ steps.vars.outputs.pr }}

runs:
using: composite
steps:
- id: vars
shell: bash
run: |
git fetch origin
release_branch="${{ github.event.pull_request.head.ref }}"
echo "Detected release branch: $release_branch"
latest_pr=$(git log origin/$release_branch --pretty=format:'%s' | grep -oP '(?<=#)\d+' | head -n 1)
if [ -z "$latest_pr" ]; then
echo "No merged PR found on $release_branch"
exit 1
elif [[ ! "$latest_pr" =~ ^[0-9]+$ ]]; then
echo "PR number format incorrect: $latest_pr"
exit 1
fi
echo "Latest PR number from $release_branch: $latest_pr"
echo "pr=$latest_pr" >> $GITHUB_OUTPUT
27 changes: 27 additions & 0 deletions .github/scripts/sysdig_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Handles sysdig terraform validation and apply

set -e # failfast
# ENV:
# APPLY: determines if plan is applied, lease as false for dry-run

cd terraform || exit 1
terraform -v
terraform init \
-backend-config="bucket=${STATE_BACKEND_BUCKET}" \
-backend-config="key=${STATE_BACKEND_FILEPATH}" \
-backend-config="access_key=${STATE_BACKEND_ACCESS_KEY}" \
-backend-config="secret_key=${STATE_BACKEND_SECRET_KEY}" \
-backend-config="endpoint=${STATE_BACKEND_ENDPOINT}"

# validate and lint check
terraform validate
terraform plan

if [ "$APPLY" = "true" ]; then
echo "APPLY=true flag provided, attempting to apply changes"
# deploy
terraform apply -auto-approve
else
echo "Dry-run, skipping apply"
fi
34 changes: 34 additions & 0 deletions .github/scripts/sysdig_installed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Fetches the sysdig team crd and checks at least 1 user is present in the config
# IMPORTANT NOTE: requires a serviceaccount with get/list on sysdig-team
# ENV:
# OC_NAMESPACE
# OC_SERVER
# OC_TOKEN
set -e # failfast
if [ -z "$OC_NAMESPACE" ]; then
echo "OC_NAMESPACE not set"
exit 1
fi
if [ -z "$OC_SERVER" ]; then
echo "OC_SERVER not set"
exit 1
fi
if [ -z "$OC_TOKEN" ]; then
echo "OC_TOKEN not set"
exit 1
fi

OC_TEMP_TOKEN=$(curl -k -X POST $OC_SERVER/api/v1/namespaces/$OC_NAMESPACE/serviceaccounts/pipeline/token --header "Authorization: Bearer $OC_TOKEN" -d '{"spec": {"expirationSeconds": 600}}' -H 'Content-Type: application/json; charset=utf-8' | jq -r '.status.token' )
oc login --token=$OC_TEMP_TOKEN --server=$OC_SERVER
oc project $OC_NAMESPACE # Safeguard!


sysdig_config=$(oc get sysdig-team -n $OC_NAMESPACE -ojson)
num_users=$(echo $sysdig_config | jq -r '.items[0].spec.team.users | length')
if [ $num_users -eq 0 ]; then
echo "No users found in sysdig-team"
exit 1
fi
echo "Found $num_users users in sysdig-team"
exit 0
64 changes: 64 additions & 0 deletions .github/workflows/deploy-sysdig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy Sysdig Alerts

on:
push:
paths:
- "terraform/**"

concurrency:
# Do not interrupt previous workflows
# avoid state corruption from cancels
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
installed:
environment: tools
name: Check Sysdig Installed
runs-on: ubuntu-22.04
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- run: ./.github/scripts/sysdig_installed.sh
env:
OC_NAMESPACE: ${{ secrets.OC_NAMESPACE }}
OC_SERVER: ${{ secrets.OC_SERVER }}
OC_TOKEN: ${{ secrets.OC_TOKEN }}

validate:
environment: tools
needs: installed
name: Validate Sysdig Terraform
runs-on: ubuntu-22.04
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Validate Sysdig Terraform
run: APPLY=false ./.github/scripts/sysdig_deploy.sh
env:
STATE_BACKEND_BUCKET: ${{ secrets.STATE_BACKEND_BUCKET }}
STATE_BACKEND_ACCESS_KEY: ${{ secrets.STATE_BACKEND_ACCESS_KEY }}
STATE_BACKEND_SECRET_KEY: ${{ secrets.STATE_BACKEND_SECRET_KEY }}
STATE_BACKEND_FILEPATH: ${{ secrets.STATE_BACKEND_FILEPATH }}
STATE_BACKEND_ENDPOINT: ${{ secrets.STATE_BACKEND_ENDPOINT }}
TF_VAR_sysdig_api_token: ${{ secrets.TF_VAR_SYSDIG_API_TOKEN }}
AWS_NO_SIGN_REQUEST: 1
deploy:
if: github.ref == 'refs/heads/main'
needs: validate
environment: tools
name: Deploy Sysdig Terraform
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Apply Sysdig Terraform
run: APPLY=true ./.github/scripts/sysdig_deploy.sh
env:
STATE_BACKEND_BUCKET: ${{ secrets.STATE_BACKEND_BUCKET }}
STATE_BACKEND_ACCESS_KEY: ${{ secrets.STATE_BACKEND_ACCESS_KEY }}
STATE_BACKEND_SECRET_KEY: ${{ secrets.STATE_BACKEND_SECRET_KEY }}
STATE_BACKEND_FILEPATH: ${{ secrets.STATE_BACKEND_FILEPATH }}
STATE_BACKEND_ENDPOINT: ${{ secrets.STATE_BACKEND_ENDPOINT }}
TF_VAR_sysdig_api_token: ${{ secrets.TF_VAR_SYSDIG_API_TOKEN }}
AWS_NO_SIGN_REQUEST: 1
13 changes: 7 additions & 6 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ jobs:
vars:
name: Set Variables
outputs:
pr: ${{ steps.pr.outputs.pr }}
pr: ${{ steps.latest-pr.outputs.pr }}
runs-on: ubuntu-22.04
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
# Get PR number for squash merges to release
- name: PR Number
id: pr
uses: ./.github/actions/get-pr-number
- name: Get Latest PR Number in release branch
id: latest-pr
uses: ./.github/actions/get-latest-pr-number
- name: Set PR Output
run: echo "pr=${{ steps.pr.outputs.pr }}" >> $GITHUB_OUTPUT
run: echo "pr=${{ steps.latest-pr.outputs.pr }}" >> $GITHUB_OUTPUT

create_release:
name: Create GitHub Release (Keep Version)
Expand Down Expand Up @@ -86,6 +85,8 @@ jobs:
--set webeoc.pdb.enabled=true
--set nats.config.cluster.replicas=3
--set nats.config.cluster.enabled=true
--set bitnami-pg.backup.cronjob.storage.size=512Mi
--set bitnami-pg.primary.persistence.size=512Mi

promote:
name: Promote Images
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/merge-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ on:
required: true

concurrency:
# Do not interrupt previous workflows
# Cancel previous pending/running workflows
group: ${{ github.workflow }}
cancel-in-progress: false
cancel-in-progress: true

jobs:
vars:
Expand Down
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,23 @@ frontend/cypress/screenshots/allegation-details-edit.cy.ts/Complaint Edit Page s
frontend/cypress/screenshots/hwcr-details-edit.cy.ts/Complaint Edit Page spec - Edit View -- Navigate to the Complaint Edit page & check inputs (failed).png
frontend/cypress/screenshots/hwcr-details-edit.cy.ts/Complaint Edit Page spec - Edit View -- it has a map on screen with a marker at the correct location (failed).png
nr-compliance-enforcement.code-workspace

# Terraform
*.tfstate
*.tfstate.*
crash.log
crash.*.log
override.tf
override.tf.json
*_override.tf
*_override.tf.json
.terraform/
.terraform.lock.hcl
**/.terraform/*
*.tfvars
*.tfvars.json
# Ignore transient lock info files created by terraform apply
.terraform.tfstate.lock.info
# Ignore CLI configuration files
.terraformrc
terraform.rc
12 changes: 12 additions & 0 deletions backend/package-lock.json

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

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"linq-to-typescript": "^11.0.0",
"nest-winston": "^1.9.2",
"npm-check-updates": "^17.1.3",
"nrs-ce-common-types": "^1.0.10",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"path-to-regexp": "^8.0.0",
Expand Down
2 changes: 2 additions & 0 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { TeamCodeModule } from "./v1/team_code/team_code.module";
import { OfficerTeamXrefModule } from "./v1/officer_team_xref/officer_team_xref.module";
import { ComplaintMethodReceivedCodeModule } from "./v1/complaint_method_received_code/complaint_method_received_code.module";
import { CompMthdRecvCdAgcyCdXrefModule } from "./v1/comp_mthd_recv_cd_agcy_cd_xref/comp_mthd_recv_cd_agcy_cd_xref.module";
import { LinkedComplaintXrefModule } from "./v1/linked_complaint_xref/linked_complaint_xref.module";

console.log("Var check - POSTGRESQL_HOST", process.env.POSTGRESQL_HOST);
console.log("Var check - POSTGRESQL_DATABASE", process.env.POSTGRESQL_DATABASE);
Expand Down Expand Up @@ -128,6 +129,7 @@ if (process.env.POSTGRESQL_PASSWORD != null) {
OfficerTeamXrefModule,
ComplaintMethodReceivedCodeModule,
CompMthdRecvCdAgcyCdXrefModule,
LinkedComplaintXrefModule,
],
controllers: [AppController],
providers: [AppService, ComplaintSequenceResetScheduler],
Expand Down
20 changes: 20 additions & 0 deletions backend/src/middleware/maps/automapper-entity-to-dto-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ export const complaintToComplaintDtoMap = (mapper: Mapper) => {
(destination) => destination.webeocId,
mapFrom((source) => source.webeoc_identifier),
),
forMember(
(destination) => destination.referenceNumber,
mapFrom((source) => source.reference_number),
),
forMember(
(destination) => destination.complaintMethodReceivedCode,
mapFrom((source) => {
Expand Down Expand Up @@ -692,6 +696,10 @@ export const applyWildlifeComplaintMap = (mapper: Mapper) => {
(destination) => destination.webeocId,
mapFrom((source) => source.complaint_identifier.webeoc_identifier),
),
forMember(
(destination) => destination.referenceNumber,
mapFrom((source) => source.complaint_identifier.reference_number),
),
forMember(
(destination) => destination.complaintMethodReceivedCode,
mapFrom((source) => {
Expand Down Expand Up @@ -915,6 +923,10 @@ export const applyAllegationComplaintMap = (mapper: Mapper) => {
(destination) => destination.webeocId,
mapFrom((source) => source.complaint_identifier.webeoc_identifier),
),
forMember(
(destination) => destination.referenceNumber,
mapFrom((source) => source.complaint_identifier.reference_number),
),
forMember(
(destination) => destination.complaintMethodReceivedCode,
mapFrom((source) => {
Expand Down Expand Up @@ -1432,6 +1444,10 @@ export const mapWildlifeReport = (mapper: Mapper, tz: string = "America/Vancouve
(destination) => destination.webeocId,
mapFrom((source) => source.complaint_identifier.webeoc_identifier),
),
forMember(
(destination) => destination.referenceNumber,
mapFrom((source) => source.complaint_identifier.reference_number),
),
forMember(
(destination) => destination.complaintMethodReceivedCode,
mapFrom((source) => {
Expand Down Expand Up @@ -1723,6 +1739,10 @@ export const mapAllegationReport = (mapper: Mapper, tz: string = "America/Vancou
(destination) => destination.webeocId,
mapFrom((source) => source.complaint_identifier.webeoc_identifier),
),
forMember(
(destination) => destination.referenceNumber,
mapFrom((source) => source.complaint_identifier.reference_number),
),
forMember(
(destination) => destination.complaintMethodReceivedCode,
mapFrom((source) => {
Expand Down
6 changes: 6 additions & 0 deletions backend/src/middleware/maps/dto-to-table-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export const mapComplaintDtoToComplaintTable = (mapper: Mapper) => {
};
}),
),
forMember(
(dest) => dest.reference_number,
mapFrom((src) => {
return src.referenceNumber;
}),
),
forMember(
(dest) => dest.is_privacy_requested,
mapFrom((src) => {
Expand Down
2 changes: 2 additions & 0 deletions backend/src/types/models/case-files/assessment-details.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { AssessmentActionDto } from "./assessment-action";
export interface AssessmentDetailsDto {
actionNotRequired: boolean;
actionCloseComplaint: boolean;
actionLinkedComplaintIdentifier: string;
actionJustificationCode: string;
actionJustificationShortDescription: string;
actionJustificationLongDescription: string;
Expand Down
3 changes: 2 additions & 1 deletion backend/src/types/models/complaints/allegation-complaint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { UUID } from "crypto";
import { ComplaintDto } from "./complaint";
import { BaseComplaint } from "nrs-ce-common-types";

export interface AllegationComplaintDto extends ComplaintDto {
export interface AllegationComplaintDto extends ComplaintDto, BaseComplaint {
ersId: UUID;
violation: string;
isInProgress: boolean;
Expand Down
Loading

0 comments on commit 019eab5

Please sign in to comment.