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

feat(FSADT1-817): adding internal pages #591

Merged
merged 23 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Fixes # (issue)

## Further comments

<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
24 changes: 16 additions & 8 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand All @@ -180,7 +182,7 @@ jobs:
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=TEST
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}

- name: Conventional Changelog Update
uses: TriPSs/conventional-changelog-action@v3
Expand Down Expand Up @@ -248,6 +250,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand All @@ -262,6 +265,7 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/legacy:${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -275,9 +279,9 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/frontend:${{ env.ZONE }}
-p VITE_KEYCLOAK_URL=https://test.loginproxy.gov.bc.ca/auth
-p VITE_KEYCLOAK_CLIENT_ID=${{ secrets.KEYCLOAK_CLIENT_ID }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Processor
uses: bcgov-nr/[email protected]
Expand All @@ -292,6 +296,7 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}

image-promotions:
name: Promote images to PROD
Expand Down Expand Up @@ -333,6 +338,8 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand All @@ -349,7 +356,7 @@ jobs:
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=PROD
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}

prod-deploy:
name: PROD Deployment
Expand Down Expand Up @@ -395,6 +402,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand All @@ -409,6 +417,7 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/legacy:${{ env.PREV }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -422,9 +431,9 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/frontend:${{ env.PREV }}
-p VITE_KEYCLOAK_URL=https://loginproxy.gov.bc.ca/auth
-p VITE_KEYCLOAK_CLIENT_ID=${{ secrets.KEYCLOAK_CLIENT_ID }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}
-p URL_ZONE=${{ env.ZONE }}

- name: Deploy Processor
uses: bcgov-nr/[email protected]
Expand All @@ -439,5 +448,4 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ env.PREV }}


-p URL_ZONE=${{ env.ZONE }}
28 changes: 22 additions & 6 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ concurrency:
jobs:
pr-validation:
name: Pull Request Validation
runs-on: ubuntu-latest
runs-on: ubuntu-latest
outputs:
version: ${{ steps.changelog.outputs.version }}
url_zone: ${{ steps.calculate.outputs.url_zone }}
permissions:
contents: read
pull-requests: write
steps:
- name: Calculate the deployment number
id: calculate
run: |
echo "url_zone=$((${{ github.event.number }} % 50))" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3

- name: Pull request size and stability labels
Expand Down Expand Up @@ -55,7 +61,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Comment PR
continue-on-error: true
uses: thollander/actions-comment-pull-request@v2
Expand All @@ -70,9 +76,11 @@ jobs:

pr-greeting:
name: PR Greeting
needs: pr-validation
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }}
URL_ZONE: $((${{ github.event.number }} % 50))
PREFIX: ${{ github.event.repository.name }}-${{ needs.pr-validation.outputs.url_zone }}
runs-on: ubuntu-22.04
permissions:
pull-requests: write
Expand Down Expand Up @@ -138,7 +146,7 @@ jobs:
environment: dev
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }}
PREFIX: ${{ github.event.repository.name }}-$((${{ github.event.number }} % 50))
ZONE: dev
runs-on: ubuntu-22.04
steps:
Expand All @@ -155,6 +163,8 @@ jobs:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand Down Expand Up @@ -184,7 +194,7 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ github.event.number }}

- name: Deploy Backend
uses: bcgov-nr/[email protected]
with:
Expand All @@ -202,6 +212,7 @@ jobs:
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
-p URL_ZONE=$((${{ github.event.number }} % 50))

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand All @@ -215,6 +226,7 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/legacy:${{ github.event.number }}
-p URL_ZONE=$((${{ github.event.number }} % 50))

- name: Deploy Frontend
uses: bcgov-nr/[email protected]
Expand All @@ -228,6 +240,7 @@ jobs:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}
-p URL_ZONE=$((${{ github.event.number }} % 50))

- name: Deploy Processor
uses: bcgov-nr/[email protected]
Expand All @@ -241,15 +254,18 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ github.event.number }}
-p URL_ZONE=$((${{ github.event.number }} % 50))

cypress-run:
name: "User flow test"
runs-on: ubuntu-22.04
needs:
- deploy
- pr-validation
environment: dev
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }}
PREFIX: ${{ github.event.repository.name }}-${{ needs.pr-validation.outputs.url_zone }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
9 changes: 6 additions & 3 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ parameters:
description: Cognito cookie domain to be used
required: true
default: gov.bc.ca
- name: URL_ZONE
description: Zone to use for URL
required: true
objects:
- apiVersion: v1
kind: ImageStream
Expand Down Expand Up @@ -99,9 +102,9 @@ objects:
name: ${NAME}
env:
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
value: https://${NAME}-${URL_ZONE}-frontend.${DOMAIN}
- name: LEGACY_URL
value: https://${NAME}-${ZONE}-legacy.${DOMAIN}
value: https://${NAME}-${URL_ZONE}-legacy.${DOMAIN}/api
- name: CHES_CLIENT_ID
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -226,7 +229,7 @@ objects:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
host: ${NAME}-${ZONE}-${COMPONENT}.${DOMAIN}
host: ${NAME}-${URL_ZONE}-${COMPONENT}.${DOMAIN}
port:
targetPort: 8080-tcp
to:
Expand Down
1 change: 0 additions & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
Expand Down
52 changes: 52 additions & 0 deletions backend/src/main/java/ca/bc/gov/app/ApplicationConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,56 @@ public final class ApplicationConstant {
)
);

public static final String SUBMISSION_DETAILS_QUERY = """
SELECT
s.submission_id,
ssc.description as status,
stc.description as submission_type,
s.submission_date,
s.update_timestamp,
s.update_user,
btc.description as business_type,
sd.incorporation_number,
sd.client_number,
sd.organization_name,
ctc.description as client_type,
sd.good_standing_ind as good_standing
FROM nrfc.submission s
left join nrfc.submission_status_code ssc on ssc.submission_status_code = s.submission_status_code\s
left join nrfc.submission_type_code stc on stc.submission_type_code = s.submission_type_code
left join nrfc.submission_detail sd on sd.submission_id = s.submission_id\s
left join nrfc.business_type_code btc on btc.business_type_code = sd.business_type_code\s
left join nrfc.client_type_code ctc on ctc.client_type_code = sd.client_type_code\s
where s.submission_id = :submissionId""";
public static final String SUBMISSION_CONTACTS_QUERY = """
SELECT
ROW_NUMBER() OVER (order by sc.submission_contact_id ) AS index,
sc.contact_type_code,
ctc.description as contact_desc,
sc.first_name,
sc.last_name,
sc.business_phone_number,
sc.email_address,
(select STRING_AGG(sl.location_name,', ') as locations from nrfc.submission_location sl left join nrfc.submission_location_contact_xref slcx on slcx.submission_location_id = sl.submission_location_id left join nrfc.submission_contact sc on sc.submission_contact_id = slcx.submission_contact_id where sl.submission_id = :submissionId) as locations,
sc.idp_user_id
FROM nrfc.submission_contact sc
left join nrfc.contact_type_code ctc on ctc.contact_type_code = sc.contact_type_code
where sc.submission_id = :submissionId""";
public static final String SUBMISSION_LOCATION_QUERY = """
SELECT
ROW_NUMBER() OVER (order by sl.submission_location_id ) AS index,
sl.street_address,
sl.country_code,
cc.description as country_desc,
sl.province_code,
pc.description as province_desc,
sl.city_name,
sl.postal_code,
sl.location_name
FROM nrfc.submission_location sl
left join nrfc.country_code cc on cc.country_code = sl.country_code
left join nrfc.province_code pc on (pc.province_code = sl.province_code and pc.country_code = cc.country_code)
where sl.submission_id = :submissionId
order by sl.submission_location_id""";
}

7 changes: 0 additions & 7 deletions backend/src/main/java/ca/bc/gov/app/BootApplication.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package ca.bc.gov.app;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@OpenAPIDefinition(info = @Info(
title = "${info.app.name}",
version = "${info.app.version}",
description = "${info.app.description}")
)
public class BootApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public static class CognitoConfiguration {
private String userPool;
private String domain;
private String url;
private String refreshUrl;
private String environment;
private String redirectUri;
private String logoutUri;
Expand All @@ -148,7 +149,14 @@ public String getUrl() {
if (StringUtils.isNotBlank(this.url)) {
return this.url;
}
return "https://" + domain + ".auth." + region + ".amazoncognito.com";
return String.format("https://%s.auth.%s.amazoncognito.com",domain,region);
}

public String getRefreshUrl(){
if(StringUtils.isNotBlank(refreshUrl)){
return refreshUrl;
}
return String.format("https://cognito-idp.%s.amazonaws.com/",region);
}
}
}
Loading
Loading