diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index deab887929..d12fa12217 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -282,6 +282,16 @@ jobs: -p COGNITO_COOKIE_DOMAIN=gov.bc.ca -p URL_ZONE=${{ env.ZONE }} + - name: Dev data replacement + uses: bcgov-nr/action-deployer-openshift@v2.1.0 + 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/action-deployer-openshift@v2.1.0 with: diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 59a45319dc..c858724fa6 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -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/action-deployer-openshift@v2.1.0 + 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/action-deployer-openshift@v2.1.0 with: diff --git a/database/openshift.dev.yml b/database/openshift.dev.yml new file mode 100644 index 0000000000..6334f124c5 --- /dev/null +++ b/database/openshift.dev.yml @@ -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 = 'alliance@mail.ca';" + 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 \ No newline at end of file diff --git a/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionLoadingService.java b/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionLoadingService.java index f6e9325440..f3a6065fd1 100644 --- a/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionLoadingService.java +++ b/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionLoadingService.java @@ -85,7 +85,7 @@ public Mono 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 @@ -126,7 +126,7 @@ public Mono buildMailMessage( ); } - private boolean isClientAdminEmail(MessagingWrapper message) { + private boolean isSubmissionStatusNew(MessagingWrapper message) { return SubmissionStatusEnum.N.equals( message .parameters()