Skip to content

Commit

Permalink
fix(FSADT1-1196): adding deployment to update division email (#799)
Browse files Browse the repository at this point in the history
* chore: renaming method

* fix(FSADT1-1196): adding deployment to update division email

* ci: fixing dev deployment

* ci: fixing it

* ci: fixing ci

* ci: updating command

* ci: updating command arg

* ci: moving to job
  • Loading branch information
paulushcgcj authored Feb 12, 2024
1 parent f883118 commit 4c356aa
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ jobs:
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ env.ZONE }}

- name: Dev data replacement
uses: bcgov-nr/[email protected]
with:
file: database/openshift.dev.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ jobs:
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ needs.pr-validation.outputs.url_zone }}

- name: Dev data replacement
uses: bcgov-nr/[email protected]
with:
file: database/openshift.dev.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
with:
Expand Down
64 changes: 64 additions & 0 deletions database/openshift.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: template.openshift.io/v1
kind: Template
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Product name
value: nr-forest-client
- name: COMPONENT
description: Component name
value: database-data
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
objects:
- kind: Job
apiVersion: batch/v1
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
spec:
template:
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
spec:
containers:
- name: ${NAME}
image: "postgres"
command: ["/bin/sh", "-c"]
args:
- |
psql -U "${POSTGRES_USER}" -h "${NAME}-${ZONE}-database" -d "${POSTGRES_DB}" -p 5432 -c "UPDATE nrfc.district_code SET email_address = '[email protected]';"
env:
- name: NAME
value: ${NAME}
- name: ZONE
value: ${ZONE}
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}
key: database-name
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}
key: database-password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}
key: database-user
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}
key: "database-password"
imagePullPolicy: Always
restartPolicy: Never
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Mono<EmailRequestDto> buildMailMessage(
// Reads the district information from the forest client district endpoint if is a client admin email
.flatMap(submissionContact ->
Mono
.just(isClientAdminEmail(message))
.just(isSubmissionStatusNew(message))
.filter(Boolean::booleanValue)
.flatMap(isAdmin ->
forestClientApi
Expand Down Expand Up @@ -126,7 +126,7 @@ public Mono<EmailRequestDto> buildMailMessage(
);
}

private boolean isClientAdminEmail(MessagingWrapper<Integer> message) {
private boolean isSubmissionStatusNew(MessagingWrapper<Integer> message) {
return SubmissionStatusEnum.N.equals(
message
.parameters()
Expand Down

0 comments on commit 4c356aa

Please sign in to comment.