From ba21a653b9b487e8b66cffb5694be391b140ec9a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 16:53:00 -0700 Subject: [PATCH 01/27] Workflow builds --- .github/workflows/pr-open.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index cdc7c1783..3243a1171 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -43,15 +43,23 @@ jobs: runs-on: ubuntu-22.04 permissions: packages: write + strategy: + matrix: + package: [backend, frontend] + include: + - package: backend + triggers: ('backend/') + - package: frontend + triggers: ('frontend/') steps: - uses: actions/checkout@v4 - uses: bcgov-nr/action-builder-ghcr@v1.2.1 with: - package: frontend + package: ${{ matrix.package }} tag: ${{ github.event.number }} tag_fallback: test token: ${{ secrets.GITHUB_TOKEN }} - triggers: ('frontend/') + triggers: ${{ matrix.triggers }} deploys: name: Deploys From 09b9e14ecb20155aac31f1006752a2cb3d33574b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 16:59:21 -0700 Subject: [PATCH 02/27] Dockerfile --- backend/Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/Dockerfile diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 000000000..40746556a --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,21 @@ +# Quarkus Images +# https://github.com/quarkusio/quarkus-images + +# "Provides the native-image executable. Used by the Maven and Gradle plugin from Quarkus to build linux64 executables" +FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build + +# Image defaults to /project; copy controlled by .dockerignore +COPY --chown=quarkus:quarkus . ./ +RUN ./mvnw package -Pnative -DskipTests + +# "A base image to run Quarkus native application using UBI Micro" +FROM quay.io/quarkus/quarkus-micro-image:2.0 + +# Port and health check +EXPOSE 8080 +HEALTHCHECK --interval=300s --timeout=3s CMD curl -f http://localhost:8080 + +# Startup +COPY --chown=1001:root --from=build /project/target/*-runner /app +USER 1001 +CMD ["/app", "-Dquarkus.http.host=0.0.0.0"] From 423a423e54b8d4d9bb8df3e348921595201a966a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 16:59:28 -0700 Subject: [PATCH 03/27] OpenShift template --- backend/openshift.deploy.yml | 188 +++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 backend/openshift.deploy.yml diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml new file mode 100644 index 000000000..712874eb6 --- /dev/null +++ b/backend/openshift.deploy.yml @@ -0,0 +1,188 @@ +apiVersion: template.openshift.io/v1 +kind: Template +parameters: + - name: NAME + description: Module name + value: quickstart-openshift-backends + - name: COMPONENT + description: Component name + value: backend-java + - name: ZONE + description: Deployment zone, e.g. pr-### or prod + required: true + - name: IMAGE_TAG + description: Image tag to use + value: latest + - name: DOMAIN + value: apps.silver.devops.gov.bc.ca + - name: CPU_REQUEST + value: "25m" + - name: MEMORY_REQUEST + value: "50Mi" + - name: CPU_LIMIT + value: "75m" + - name: MEMORY_LIMIT + value: "150Mi" + - name: MIN_REPLICAS + description: The minimum amount of replicas for the horizontal pod autoscaler. + value: "3" + - name: MAX_REPLICAS + description: The maximum amount of replicas for the horizontal pod autoscaler. + value: "5" + - name: REGISTRY + description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) + value: ghcr.io + - name: ORG_NAME + description: Organization name, e.g. bcgov + value: bcgov + - name: PROMOTE + description: Image (namespace/name:tag) to promote/import + value: bcgov/quickstart-openshift-backends/backend-java:test +objects: + - apiVersion: v1 + kind: ImageStream + metadata: + labels: + app: "${NAME}-${ZONE}" + name: "${NAME}-${ZONE}-${COMPONENT}" + spec: + lookupPolicy: + local: false + tags: + - name: "${IMAGE_TAG}" + from: + kind: DockerImage + name: "${REGISTRY}/${PROMOTE}" + referencePolicy: + type: Local + - apiVersion: v1 + kind: DeploymentConfig + metadata: + labels: + app: "${NAME}-${ZONE}" + name: "${NAME}-${ZONE}-${COMPONENT}" + spec: + replicas: 1 + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - "${NAME}" + from: + kind: ImageStreamTag + name: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + selector: + deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + strategy: + type: Rolling + template: + metadata: + labels: + app: "${NAME}-${ZONE}" + deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + spec: + containers: + - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + imagePullPolicy: Always + name: "${NAME}" + env: + - name: POSTGRES_HOST + value: "${NAME}-${ZONE}-database" + - name: POSTGRES_DATABASE + valueFrom: + secretKeyRef: + name: "${NAME}-${ZONE}-database" + key: database-name + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: "${NAME}-${ZONE}-database" + key: database-password + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: "${NAME}-${ZONE}-database" + key: database-user + + ports: + - containerPort: 3000 + protocol: TCP + resources: + requests: + cpu: "${CPU_REQUEST}" + memory: "${MEMORY_REQUEST}" + limits: + cpu: "${CPU_LIMIT}" + memory: "${MEMORY_LIMIT}" + readinessProbe: + httpGet: + path: / + port: 3000 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 2 + timeoutSeconds: 2 + successThreshold: 1 + failureThreshold: 30 + livenessProbe: + successThreshold: 1 + failureThreshold: 3 + httpGet: + path: / + port: 3000 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 30 + timeoutSeconds: 5 + + - apiVersion: v1 + kind: Service + metadata: + labels: + app: "${NAME}-${ZONE}" + name: "${NAME}-${ZONE}-${COMPONENT}" + spec: + ports: + - name: 3000-tcp + protocol: TCP + port: 80 + targetPort: 3000 + selector: + deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + - apiVersion: route.openshift.io/v1 + kind: Route + metadata: + labels: + app: "${NAME}-${ZONE}" + name: "${NAME}-${ZONE}-${COMPONENT}" + spec: + host: "${NAME}-${ZONE}-${COMPONENT}.${DOMAIN}" + port: + targetPort: 3000-tcp + to: + kind: Service + name: "${NAME}-${ZONE}-${COMPONENT}" + weight: 100 + tls: + termination: edge + insecureEdgeTerminationPolicy: Redirect + - apiVersion: autoscaling/v2 + kind: HorizontalPodAutoscaler + metadata: + name: "${NAME}-${ZONE}-${COMPONENT}" + spec: + scaleTargetRef: + apiVersion: apps.openshift.io/v1 + kind: DeploymentConfig + name: "${NAME}-${ZONE}-${COMPONENT}" + minReplicas: "${{MIN_REPLICAS}}" + maxReplicas: "${{MAX_REPLICAS}}" + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 100 From 4127f82b15750c10eec8fb83b6b65a11ac1d1f2e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 17:00:07 -0700 Subject: [PATCH 04/27] PR description --- .github/workflows/pr-open.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 3243a1171..6fbd9d791 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -32,6 +32,7 @@ jobs: Thanks for the PR! Any successful deployments (not always required) will be available below. + [Backend](https://${{ env.PREFIX }}-backend.${{ env.DOMAIN }}) [Frontend](https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}) Once merged, code will be promoted and handed off to following workflow run. From d02d530c3aef7a2cf22ecbcddd51c5653007eb8e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 17:06:41 -0700 Subject: [PATCH 05/27] Workflow deploys --- .github/workflows/pr-open.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 6fbd9d791..e647b22da 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -2,8 +2,7 @@ name: Pull Request on: pull_request: - branches: - - main + branches: [main] concurrency: # PR open and close use the same group, allowing only one at a time @@ -65,13 +64,22 @@ jobs: deploys: name: Deploys if: "!github.event.pull_request.head.repo.fork" - needs: - - builds + needs: [builds] runs-on: ubuntu-22.04 + strategy: + matrix: + package: [backend, frontend] + include: + - package: backend + file: backend/openshift.deploy.yml + triggers: ('backend/' 'frontend/') + - package: frontend + file: frontend/openshift.deploy.yml + triggers: ('backend/' 'frontend/') steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: - file: frontend/openshift.deploy.yml + file: ${{ matrix.file }} oc_namespace: ${{ vars.OC_NAMESPACE }} oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} @@ -82,4 +90,4 @@ jobs: -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - triggers: ('frontend/') + triggers: ${{ matrix.triggers }} From 210edeaeef492330ddaf045c55c2bb8f5416fbcb Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 28 Sep 2023 17:15:11 -0700 Subject: [PATCH 06/27] Workflows, including merge.yml --- .github/workflows/merge-main.yml | 37 ++++++++++++++++++++++---------- .github/workflows/pr-open.yml | 22 ++++++++++--------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index 8ff5a6a64..ad02def0a 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -41,22 +41,30 @@ jobs: runs-on: ubuntu-22.04 permissions: issues: write + strategy: + matrix: + name: [backend, frontend] + include: + - name: backend + - name: frontend + parameters: + -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} + -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: - file: frontend/openshift.deploy.yml + file: ${{ matrix.name }}/openshift.deploy.yml oc_namespace: ${{ vars.OC_NAMESPACE }} oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} overwrite: true parameters: - -p ZONE=test -p PROMOTE=${{ github.repository }}/frontend:test + -p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test -p NAME=${{ github.event.repository.name }} - -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} - -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} + ${{ matrix.parameters }} penetration_test: true - penetration_test_artifact: frontend - penetration_test_issue: frontend + penetration_test_artifact: ${{ matrix.name }} + penetration_test_issue: ${{ matrix.name }} penetration_test_token: ${{ secrets.GITHUB_SECRET }} deploys-prod: @@ -65,20 +73,27 @@ jobs: - deploys-test environment: prod runs-on: ubuntu-22.04 + strategy: + matrix: + name: [backend, frontend] + include: + - name: backend + paratemeters: + -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} + -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} + -p VITE_REDIRECT_SIGN_OUT="${{ vars.VITE_REDIRECT_SIGN_OUT }}" + - name: frontend steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: - file: frontend/openshift.deploy.yml + file: ${{ matrix.name }}/openshift.deploy.yml oc_namespace: ${{ vars.OC_NAMESPACE }} oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} overwrite: true parameters: - -p ZONE=prod -p PROMOTE=${{ github.repository }}/frontend:test + -p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test -p NAME=${{ github.event.repository.name }} - -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} - -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} - -p VITE_REDIRECT_SIGN_OUT="${{ vars.VITE_REDIRECT_SIGN_OUT }}" image-promotions: name: Promote images to PROD diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index e647b22da..132ccf8e9 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -45,17 +45,17 @@ jobs: packages: write strategy: matrix: - package: [backend, frontend] + name: [backend, frontend] include: - - package: backend + - name: backend triggers: ('backend/') - - package: frontend + - name: frontend triggers: ('frontend/') steps: - uses: actions/checkout@v4 - uses: bcgov-nr/action-builder-ghcr@v1.2.1 with: - package: ${{ matrix.package }} + package: ${{ matrix.name }} tag: ${{ github.event.number }} tag_fallback: test token: ${{ secrets.GITHUB_TOKEN }} @@ -68,18 +68,21 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - package: [backend, frontend] + name: [backend, frontend] include: - - package: backend + - name: backend file: backend/openshift.deploy.yml triggers: ('backend/' 'frontend/') - - package: frontend + - name: frontend file: frontend/openshift.deploy.yml triggers: ('backend/' 'frontend/') + parameters: + -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} + -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: - file: ${{ matrix.file }} + file: ${{ matrix.name }}/openshift.deploy.yml oc_namespace: ${{ vars.OC_NAMESPACE }} oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} @@ -87,7 +90,6 @@ jobs: parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }} - -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} - -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + ${{ matrix.parameters }} triggers: ${{ matrix.triggers }} From 5ae47c6339e77a5dfb45bf7264bfbc3300a2c645 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 16:27:02 -0700 Subject: [PATCH 07/27] Remove db ref from backend/opeshift.deploy.yml --- backend/openshift.deploy.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 712874eb6..28e6520a5 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -87,25 +87,6 @@ objects: - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" imagePullPolicy: Always name: "${NAME}" - env: - - name: POSTGRES_HOST - value: "${NAME}-${ZONE}-database" - - name: POSTGRES_DATABASE - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - ports: - containerPort: 3000 protocol: TCP From 6cb68e0db6b43cfcf81517f68b2af1c8f119869a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 16:29:39 -0700 Subject: [PATCH 08/27] Cleanup references and names --- backend/openshift.deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 28e6520a5..ac9496ee3 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -6,7 +6,7 @@ parameters: value: quickstart-openshift-backends - name: COMPONENT description: Component name - value: backend-java + value: backend - name: ZONE description: Deployment zone, e.g. pr-### or prod required: true @@ -37,7 +37,7 @@ parameters: value: bcgov - name: PROMOTE description: Image (namespace/name:tag) to promote/import - value: bcgov/quickstart-openshift-backends/backend-java:test + value: bcgov/quickstart-openshift-backends/backend:test objects: - apiVersion: v1 kind: ImageStream From ad7aa8887d1034ee48a88f6c446be46f8f7bb691 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 16:32:39 -0700 Subject: [PATCH 09/27] Test just backend deploy --- .github/workflows/pr-open.yml | 106 +++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 132ccf8e9..d435e35dd 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -11,74 +11,74 @@ concurrency: jobs: - pr-greeting: - if: "!github.event.pull_request.head.repo.fork" - name: PR Greeting - env: - DOMAIN: apps.silver.devops.gov.bc.ca - PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }} - runs-on: ubuntu-22.04 - permissions: - pull-requests: write - steps: - - name: PR Greeting - uses: bcgov-nr/action-pr-description-add@v1.1.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - add_markdown: | - --- + # pr-greeting: + # if: "!github.event.pull_request.head.repo.fork" + # name: PR Greeting + # env: + # DOMAIN: apps.silver.devops.gov.bc.ca + # PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }} + # runs-on: ubuntu-22.04 + # permissions: + # pull-requests: write + # steps: + # - name: PR Greeting + # uses: bcgov-nr/action-pr-description-add@v1.1.0 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # add_markdown: | + # --- - Thanks for the PR! + # Thanks for the PR! - Any successful deployments (not always required) will be available below. - [Backend](https://${{ env.PREFIX }}-backend.${{ env.DOMAIN }}) - [Frontend](https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}) + # Any successful deployments (not always required) will be available below. + # [Backend](https://${{ env.PREFIX }}-backend.${{ env.DOMAIN }}) + # [Frontend](https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}) - Once merged, code will be promoted and handed off to following workflow run. - [Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml) + # Once merged, code will be promoted and handed off to following workflow run. + # [Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml) - builds: - name: Builds - if: "!github.event.pull_request.head.repo.fork" - runs-on: ubuntu-22.04 - permissions: - packages: write - strategy: - matrix: - name: [backend, frontend] - include: - - name: backend - triggers: ('backend/') - - name: frontend - triggers: ('frontend/') - steps: - - uses: actions/checkout@v4 - - uses: bcgov-nr/action-builder-ghcr@v1.2.1 - with: - package: ${{ matrix.name }} - tag: ${{ github.event.number }} - tag_fallback: test - token: ${{ secrets.GITHUB_TOKEN }} - triggers: ${{ matrix.triggers }} + # builds: + # name: Builds + # if: "!github.event.pull_request.head.repo.fork" + # runs-on: ubuntu-22.04 + # permissions: + # packages: write + # strategy: + # matrix: + # name: [backend, frontend] + # include: + # - name: backend + # triggers: ('backend/') + # - name: frontend + # triggers: ('frontend/') + # steps: + # - uses: actions/checkout@v4 + # - uses: bcgov-nr/action-builder-ghcr@v1.2.1 + # with: + # package: ${{ matrix.name }} + # tag: ${{ github.event.number }} + # tag_fallback: test + # token: ${{ secrets.GITHUB_TOKEN }} + # triggers: ${{ matrix.triggers }} deploys: name: Deploys if: "!github.event.pull_request.head.repo.fork" - needs: [builds] + # needs: [builds] runs-on: ubuntu-22.04 strategy: matrix: - name: [backend, frontend] + # name: [backend, frontend] include: - name: backend file: backend/openshift.deploy.yml triggers: ('backend/' 'frontend/') - - name: frontend - file: frontend/openshift.deploy.yml - triggers: ('backend/' 'frontend/') - parameters: - -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} - -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} + # - name: frontend + # file: frontend/openshift.deploy.yml + # triggers: ('backend/' 'frontend/') + # parameters: + # -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} + # -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: From 9d15df547423dde6f57cae65ce769e220a9cbb06 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 16:45:07 -0700 Subject: [PATCH 10/27] Test just backend --- .github/workflows/pr-open.yml | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d435e35dd..d4de19ba9 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -37,34 +37,34 @@ jobs: # Once merged, code will be promoted and handed off to following workflow run. # [Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml) - # builds: - # name: Builds - # if: "!github.event.pull_request.head.repo.fork" - # runs-on: ubuntu-22.04 - # permissions: - # packages: write - # strategy: - # matrix: - # name: [backend, frontend] - # include: - # - name: backend - # triggers: ('backend/') - # - name: frontend - # triggers: ('frontend/') - # steps: - # - uses: actions/checkout@v4 - # - uses: bcgov-nr/action-builder-ghcr@v1.2.1 - # with: - # package: ${{ matrix.name }} - # tag: ${{ github.event.number }} - # tag_fallback: test - # token: ${{ secrets.GITHUB_TOKEN }} - # triggers: ${{ matrix.triggers }} + builds: + name: Builds + if: "!github.event.pull_request.head.repo.fork" + runs-on: ubuntu-22.04 + permissions: + packages: write + strategy: + matrix: + # name: [backend, frontend] + include: + - name: backend + triggers: ('backend/') + # - name: frontend + # triggers: ('frontend/') + steps: + - uses: actions/checkout@v4 + - uses: bcgov-nr/action-builder-ghcr@v1.2.1 + with: + package: ${{ matrix.name }} + tag: ${{ github.event.number }} + tag_fallback: test + token: ${{ secrets.GITHUB_TOKEN }} + triggers: ${{ matrix.triggers }} deploys: name: Deploys if: "!github.event.pull_request.head.repo.fork" - # needs: [builds] + needs: [builds] runs-on: ubuntu-22.04 strategy: matrix: From dcae8aa1713ec312399d57a3322f576453aca526 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 18:36:12 -0700 Subject: [PATCH 11/27] +backend/.dockerignore --- backend/.dockerignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 backend/.dockerignore diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 000000000..a1b682302 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,6 @@ +.env +Dockerfile +*.yml +*.yaml +*.md +**/target/ From 497d2fccddab7bf154600982a27be4607125b363 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 18:43:44 -0700 Subject: [PATCH 12/27] Fix backend/Dockerfile --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 40746556a..41a992fd2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -16,6 +16,6 @@ EXPOSE 8080 HEALTHCHECK --interval=300s --timeout=3s CMD curl -f http://localhost:8080 # Startup -COPY --chown=1001:root --from=build /project/target/*-runner /app +COPY --chown=1001:root --from=build /project/target/results /app USER 1001 CMD ["/app", "-Dquarkus.http.host=0.0.0.0"] From b6df7bce5bee8d30b4257dd6059bfd579fc6cee8 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 18:51:00 -0700 Subject: [PATCH 13/27] docker-compose.yml + backend-native --- docker-compose.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 704be899f..2f5d37cb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '3.9' -x-common: &common +x-frontend: &frontend environment: VITE_USER_POOLS_ID: ca-central-1_t2HSZBHur VITE_USER_POOLS_WEB_CLIENT_ID: 3g6n2ha1loi4kp1jhaq359vrvb @@ -12,6 +12,14 @@ x-common: &common retries: 5 restart: always +x-backend: &backend + ports: ["8080:8080"] + healthcheck: + test: curl -f http://localhost:8080/actuator/health | grep '"status":"UP"' + interval: 5s + timeout: 5s + retries: 5 + services: frontend: container_name: frontend @@ -20,7 +28,7 @@ services: ports: ["3000:3000"] volumes: ["./frontend:/app", "/app/node_modules"] working_dir: "/app" - <<: *common + <<: *frontend caddy: container_name: caddy @@ -28,17 +36,18 @@ services: build: ./frontend ports: ["3005:3000"] volumes: ["./frontend/Caddyfile:/etc/caddy/Caddyfile"] - <<: *common + <<: *frontend backend: container_name: backend - ports: ["8080:8080", "5005:5005"] + entrypoint: mvn -ntp spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n" image: maven:3.9.4-amazoncorretto-21 - entrypoint: mvn -ntp spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005" - working_dir: /app volumes: ["./backend:/app"] - healthcheck: - test: curl -f http://localhost:8080/actuator/health | grep '"status":"UP"' - interval: 5s - timeout: 5s - retries: 5 + working_dir: /app + <<: *backend + + backend-native: + container_name: backend-native + profiles: ["native"] + build: ./backend + <<: *backend From 5c41c722691a154aae7bebc2471bca0cc9cbc4a6 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 18:59:20 -0700 Subject: [PATCH 14/27] Compose tweaks --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2f5d37cb2..a4ee66b9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,11 @@ version: '3.9' x-frontend: &frontend environment: - VITE_USER_POOLS_ID: ca-central-1_t2HSZBHur + VITE_USER_POOLS_ID: ca-central-1_FxagSNQa7 VITE_USER_POOLS_WEB_CLIENT_ID: 3g6n2ha1loi4kp1jhaq359vrvb VITE_ZONE: DEV healthcheck: - test: [ "CMD-SHELL", "curl http://localhost:3000" ] + test: curl http://localhost:3000" interval: 15s timeout: 5s retries: 5 @@ -19,6 +19,7 @@ x-backend: &backend interval: 5s timeout: 5s retries: 5 + restart: always services: frontend: From 56c297165855aeec783158835b79154b9b28fea7 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 19:10:59 -0700 Subject: [PATCH 15/27] Ports --- backend/openshift.deploy.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index ac9496ee3..422a929d8 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -88,7 +88,7 @@ objects: imagePullPolicy: Always name: "${NAME}" ports: - - containerPort: 3000 + - containerPort: 8080 protocol: TCP resources: requests: @@ -99,8 +99,8 @@ objects: memory: "${MEMORY_LIMIT}" readinessProbe: httpGet: - path: / - port: 3000 + path: /actuator/health + port: 8080 scheme: HTTP initialDelaySeconds: 5 periodSeconds: 2 @@ -111,13 +111,12 @@ objects: successThreshold: 1 failureThreshold: 3 httpGet: - path: / - port: 3000 + path: /actuator/health + port: 8080 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 5 - - apiVersion: v1 kind: Service metadata: @@ -126,10 +125,10 @@ objects: name: "${NAME}-${ZONE}-${COMPONENT}" spec: ports: - - name: 3000-tcp + - name: 8080-tcp protocol: TCP port: 80 - targetPort: 3000 + targetPort: 8080 selector: deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - apiVersion: route.openshift.io/v1 @@ -141,7 +140,7 @@ objects: spec: host: "${NAME}-${ZONE}-${COMPONENT}.${DOMAIN}" port: - targetPort: 3000-tcp + targetPort: 8080-tcp to: kind: Service name: "${NAME}-${ZONE}-${COMPONENT}" From a214bf3b042506cd8a8c338d65b973b01561fda3 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 19:13:14 -0700 Subject: [PATCH 16/27] Deploy fix --- .github/workflows/pr-open.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d4de19ba9..f765fc3c9 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -46,6 +46,7 @@ jobs: strategy: matrix: # name: [backend, frontend] + name: [backend] include: - name: backend triggers: ('backend/') @@ -69,10 +70,11 @@ jobs: strategy: matrix: # name: [backend, frontend] + name: [backend] include: - name: backend file: backend/openshift.deploy.yml - triggers: ('backend/' 'frontend/') + # triggers: ('backend/' 'frontend/') # - name: frontend # file: frontend/openshift.deploy.yml # triggers: ('backend/' 'frontend/') @@ -89,7 +91,7 @@ jobs: overwrite: true parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} - -p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }} + -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }} -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 ${{ matrix.parameters }} triggers: ${{ matrix.triggers }} From 3a88ed41c85f4090192115a106d348d27d621b89 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 21:51:56 -0700 Subject: [PATCH 17/27] Restore workflows --- .github/workflows/pr-open.yml | 68 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index f765fc3c9..52977aa83 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -11,31 +11,31 @@ concurrency: jobs: - # pr-greeting: - # if: "!github.event.pull_request.head.repo.fork" - # name: PR Greeting - # env: - # DOMAIN: apps.silver.devops.gov.bc.ca - # PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }} - # runs-on: ubuntu-22.04 - # permissions: - # pull-requests: write - # steps: - # - name: PR Greeting - # uses: bcgov-nr/action-pr-description-add@v1.1.0 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # add_markdown: | - # --- + pr-greeting: + if: "!github.event.pull_request.head.repo.fork" + name: PR Greeting + env: + DOMAIN: apps.silver.devops.gov.bc.ca + PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }} + runs-on: ubuntu-22.04 + permissions: + pull-requests: write + steps: + - name: PR Greeting + uses: bcgov-nr/action-pr-description-add@v1.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + add_markdown: | + --- - # Thanks for the PR! + Thanks for the PR! - # Any successful deployments (not always required) will be available below. - # [Backend](https://${{ env.PREFIX }}-backend.${{ env.DOMAIN }}) - # [Frontend](https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}) + Any successful deployments (not always required) will be available below. + [Backend](https://${{ env.PREFIX }}-backend.${{ env.DOMAIN }}) + [Frontend](https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}) - # Once merged, code will be promoted and handed off to following workflow run. - # [Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml) + Once merged, code will be promoted and handed off to following workflow run. + [Main Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge-main.yml) builds: name: Builds @@ -45,13 +45,12 @@ jobs: packages: write strategy: matrix: - # name: [backend, frontend] - name: [backend] + name: [backend, frontend] include: - name: backend triggers: ('backend/') - # - name: frontend - # triggers: ('frontend/') + - name: frontend + triggers: ('frontend/') steps: - uses: actions/checkout@v4 - uses: bcgov-nr/action-builder-ghcr@v1.2.1 @@ -69,18 +68,17 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - # name: [backend, frontend] - name: [backend] + name: [backend, frontend] include: - name: backend file: backend/openshift.deploy.yml - # triggers: ('backend/' 'frontend/') - # - name: frontend - # file: frontend/openshift.deploy.yml - # triggers: ('backend/' 'frontend/') - # parameters: - # -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} - # -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} + triggers: ('backend/' 'frontend/') + - name: frontend + file: frontend/openshift.deploy.yml + triggers: ('backend/' 'frontend/') + parameters: + -p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }} + -p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 with: From 784db6f53a9c59ca033074155ed63a386a217c0b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 21:58:14 -0700 Subject: [PATCH 18/27] Compatibility mode --- backend/src/main/resources/application.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index b8acfdd2b..d3c8301c4 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -9,3 +9,6 @@ management.endpoint.health.show-details = always # Native Cloud springdoc.enable-native-support = true + +# https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.2 +quarkus.native.additional-build-args=-march=compatibility From a46cd6a611eef96d52a4a3d91a618bac9a6db95e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 22:10:16 -0700 Subject: [PATCH 19/27] Verification path --- .github/workflows/pr-open.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 52977aa83..bfbee0400 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -73,6 +73,7 @@ jobs: - name: backend file: backend/openshift.deploy.yml triggers: ('backend/' 'frontend/') + verification_path: /actuator/health - name: frontend file: frontend/openshift.deploy.yml triggers: ('backend/' 'frontend/') @@ -93,3 +94,4 @@ jobs: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 ${{ matrix.parameters }} triggers: ${{ matrix.triggers }} + verification_path: ${{ matrix.verification_path }} From e33f1535f5813c750020abd0bafe301e389642be Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 22:35:57 -0700 Subject: [PATCH 20/27] Backend tests in workflows --- .github/workflows/unit-tests.yml | 56 +++++++++++++++++--------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index a622ffc93..f2cfa32d9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,15 +1,10 @@ -name: Unit Tests and Analysis +name: Analysis on: pull_request: - types: - - opened - - reopened - - synchronize - - ready_for_review + types: [opened, reopened, synchronize, ready_for_review] push: - branches: - - main + branches: [main] workflow_dispatch: concurrency: @@ -17,24 +12,10 @@ concurrency: cancel-in-progress: true jobs: - # Note: uncomment code below once a backend is written - tests: - name: Unit Tests + frontend: + name: Frontend Tests if: github.event_name != 'pull_request' || !github.event.pull_request.draft runs-on: ubuntu-22.04 - strategy: - matrix: - # dir: [backend, frontend] - dir: [frontend] - include: - # - dir: backend - # sonar_projectKey: nr-silva-backend - # token: SONAR_TOKEN_BACKEND - # triggers: ('backend/') - - dir: frontend - sonar_projectKey: nr-silva-frontend - token: SONAR_TOKEN_FRONTEND - triggers: ('frontend/') steps: - uses: bcgov-nr/action-test-and-analyse@v1.1.0 with: @@ -47,13 +28,34 @@ jobs: -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts -Dsonar.organization=bcgov-sonarcloud -Dsonar.project.monorepo.enabled=true - -Dsonar.projectKey=${{ matrix.sonar_projectKey }} + -Dsonar.projectKey=nr-silva-frontend -Dsonar.sources=src -Dsonar.tests.inclusions=**/*spec.ts -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info - sonar_token: ${{ secrets[matrix.token] }} + sonar_token: ${{ secrets.SONAR_TOKEN_FRONTEND }} # Only use triggers for PRs - triggers: ${{ github.event_name == 'pull_request' && matrix.triggers || '' }} + triggers: ${{ github.event_name == 'pull_request' && '("frontend/")' || '' }} + + backend: + name: Backend Tests + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: ubuntu-22.04 + steps: + - uses: bcgov-nr/actoin-test-and-analyse-java@v0.2.0 + with: + commands: mvn clean package + dir: backend + java-cache: maven + java-distribution: temurin + java-version: 17 + sonar_args: > + -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts + -Dsonar.organization=bcgov-sonarcloud + -Dsonar.project.monorepo.enabled=true + -Dsonar.projectKey=nr-silva-backend + -Dsonar.sources=src + sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} + triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} # https://github.com/marketplace/actions/aqua-security-trivy trivy: From 7d021bd8772cc4a2d675018ad2841deaed6635e8 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 22:37:05 -0700 Subject: [PATCH 21/27] .github/workflows/unit-tests.yml -> .github/workflows/analysis.yml --- .github/workflows/{unit-tests.yml => analysis.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{unit-tests.yml => analysis.yml} (100%) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/analysis.yml similarity index 100% rename from .github/workflows/unit-tests.yml rename to .github/workflows/analysis.yml From f31bdb5b0e8bea347c02caa9cb0ac683bc326423 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 22:37:38 -0700 Subject: [PATCH 22/27] .github/workflows/merge-main.yml -> .github/workflows/merge.yml --- .github/workflows/{merge-main.yml => merge.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{merge-main.yml => merge.yml} (100%) diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge.yml similarity index 100% rename from .github/workflows/merge-main.yml rename to .github/workflows/merge.yml From 7c9303a5ff5e17974548a2bd67878ec84a6c259c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 22:40:15 -0700 Subject: [PATCH 23/27] Merge workflow --- .github/workflows/analysis.yml | 2 +- .github/workflows/merge.yml | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index f2cfa32d9..7e7b437a0 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -41,7 +41,7 @@ jobs: if: github.event_name != 'pull_request' || !github.event.pull_request.draft runs-on: ubuntu-22.04 steps: - - uses: bcgov-nr/actoin-test-and-analyse-java@v0.2.0 + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 with: commands: mvn clean package dir: backend diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index ad02def0a..995f9e74c 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,10 +1,9 @@ -name: Merge to Main +name: Merge on: workflow_run: workflows: [ "Pull Request Closed" ] - types: - - completed + types: [completed] workflow_dispatch: concurrency: @@ -69,8 +68,7 @@ jobs: deploys-prod: name: PROD Deployments - needs: - - deploys-test + needs: [deploys-test] environment: prod runs-on: ubuntu-22.04 strategy: @@ -97,8 +95,7 @@ jobs: image-promotions: name: Promote images to PROD - needs: - - deploys-prod + needs: [deploys-prod] runs-on: ubuntu-22.04 permissions: packages: write From 9ebcb3f0e0a60a7adce0c275f6d40a76c598d94c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 23:00:11 -0700 Subject: [PATCH 24/27] Comment out backend tests --- .github/workflows/analysis.yml | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 7e7b437a0..18eaf158c 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -36,26 +36,26 @@ jobs: # Only use triggers for PRs triggers: ${{ github.event_name == 'pull_request' && '("frontend/")' || '' }} - backend: - name: Backend Tests - if: github.event_name != 'pull_request' || !github.event.pull_request.draft - runs-on: ubuntu-22.04 - steps: - - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 - with: - commands: mvn clean package - dir: backend - java-cache: maven - java-distribution: temurin - java-version: 17 - sonar_args: > - -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts - -Dsonar.organization=bcgov-sonarcloud - -Dsonar.project.monorepo.enabled=true - -Dsonar.projectKey=nr-silva-backend - -Dsonar.sources=src - sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} - triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} + # backend: + # name: Backend Tests + # if: github.event_name != 'pull_request' || !github.event.pull_request.draft + # runs-on: ubuntu-22.04 + # steps: + # - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 + # with: + # commands: mvn clean package + # dir: backend + # java-cache: maven + # java-distribution: temurin + # java-version: 17 + # sonar_args: > + # -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts + # -Dsonar.organization=bcgov-sonarcloud + # -Dsonar.project.monorepo.enabled=true + # -Dsonar.projectKey=nr-silva-backend + # -Dsonar.sources=src + # sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} + # triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} # https://github.com/marketplace/actions/aqua-security-trivy trivy: From 17fa839d0053a219f00d9e2f6e1ddfa10111ef5a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 3 Oct 2023 23:05:35 -0700 Subject: [PATCH 25/27] Try march=x86-64-v2 --- backend/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index d3c8301c4..5c7c4e1d0 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -11,4 +11,4 @@ management.endpoint.health.show-details = always springdoc.enable-native-support = true # https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.2 -quarkus.native.additional-build-args=-march=compatibility +quarkus.native.additional-build-args=-march=x86-64-v2 From 8d8d14d24dd511f34e907d923588501c774405ae Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 4 Oct 2023 09:35:28 -0700 Subject: [PATCH 26/27] Fix DC VITE_USER_POOLS_ID --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a4ee66b9a..416eecfab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.9' x-frontend: &frontend environment: - VITE_USER_POOLS_ID: ca-central-1_FxagSNQa7 + VITE_USER_POOLS_ID: ca-central-1_t2HSZBHur VITE_USER_POOLS_WEB_CLIENT_ID: 3g6n2ha1loi4kp1jhaq359vrvb VITE_ZONE: DEV healthcheck: From 312f2fcb675f32ba976befe329c342b4867a5b0a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 4 Oct 2023 09:36:26 -0700 Subject: [PATCH 27/27] Enable backend tests (w/ fails) --- .github/workflows/analysis.yml | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 18eaf158c..7e7b437a0 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -36,26 +36,26 @@ jobs: # Only use triggers for PRs triggers: ${{ github.event_name == 'pull_request' && '("frontend/")' || '' }} - # backend: - # name: Backend Tests - # if: github.event_name != 'pull_request' || !github.event.pull_request.draft - # runs-on: ubuntu-22.04 - # steps: - # - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 - # with: - # commands: mvn clean package - # dir: backend - # java-cache: maven - # java-distribution: temurin - # java-version: 17 - # sonar_args: > - # -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts - # -Dsonar.organization=bcgov-sonarcloud - # -Dsonar.project.monorepo.enabled=true - # -Dsonar.projectKey=nr-silva-backend - # -Dsonar.sources=src - # sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} - # triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} + backend: + name: Backend Tests + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: ubuntu-22.04 + steps: + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 + with: + commands: mvn clean package + dir: backend + java-cache: maven + java-distribution: temurin + java-version: 17 + sonar_args: > + -Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts + -Dsonar.organization=bcgov-sonarcloud + -Dsonar.project.monorepo.enabled=true + -Dsonar.projectKey=nr-silva-backend + -Dsonar.sources=src + sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} + triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} # https://github.com/marketplace/actions/aqua-security-trivy trivy: