Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
75 changes: 75 additions & 0 deletions database/openshift.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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: DeploymentConfig
apiVersion: v1
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
spec:
replicas: 1
selector:
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
strategy:
type: Recreate
recreateParams:
timeoutSeconds: 600
activeDeadlineSeconds: 21600
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 ${POSTGRESQL_USER} \
-h ${NAME}-${ZONE}-database \
-d ${POSTGRESQL_DATABASE} \
-c "UPDATE nrfc.district_code SET email_address = '[email protected]';"
env:
- 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
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
schedulerName: default-scheduler
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
Loading