generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/303-create-recent-openings-api
- Loading branch information
Showing
27 changed files
with
1,127 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Analysis | |
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft] | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
@@ -12,8 +12,30 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
frontend: | ||
name: Frontend Tests | ||
tests-backend: | ||
name: Tests (Backend) | ||
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
commands: mvn --no-transfer-progress clean compile verify package checkstyle:checkstyle -P all-tests | ||
dir: backend | ||
java-cache: maven | ||
java-distribution: temurin | ||
java-version: 21 | ||
sonar_args: > | ||
-Dsonar.exclusions=**/config/**,*/dto/**,**/entity/**,**/exception/**,**/response/**,**/*$*Builder*,**/RestExceptionEndpoint.*,**/ResultsApplication.* | ||
-Dsonar.coverage.jacoco.xmlReportPaths=target/coverage-reports/merged-test-report/jacoco.xml | ||
-Dsonar.organization=bcgov-sonarcloud | ||
-Dsonar.project.monorepo.enabled=true | ||
-Dsonar.projectKey=nr-silva-backend | ||
sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} | ||
# Only use triggers for PRs | ||
triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} | ||
|
||
tests-frontend: | ||
name: Tests (Frontend) | ||
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
|
@@ -36,73 +58,33 @@ 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/[email protected] | ||
with: | ||
commands: mvn --no-transfer-progress clean compile verify package checkstyle:checkstyle -P all-tests | ||
dir: backend | ||
java-cache: maven | ||
java-distribution: temurin | ||
java-version: 21 | ||
sonar_args: > | ||
-Dsonar.exclusions=**/config/**,*/dto/**,**/entity/**,**/exception/**,**/response/**,**/*$*Builder*,**/RestExceptionEndpoint.*,**/ResultsApplication.* | ||
-Dsonar.coverage.jacoco.xmlReportPaths=target/coverage-reports/merged-test-report/jacoco.xml | ||
-Dsonar.organization=bcgov-sonarcloud | ||
-Dsonar.project.monorepo.enabled=true | ||
-Dsonar.projectKey=nr-silva-backend | ||
sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }} | ||
# Only use triggers for PRs | ||
triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }} | ||
|
||
codeql: | ||
name: CodeQL | ||
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
language: [java, javascript] | ||
include: | ||
- language: "java" | ||
working-directory: backend | ||
build: ./mvnw package -DskipTests | ||
- language: "javascript" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Autobuild | ||
if: ${{ ! matrix.build }} | ||
uses: github/codeql-action/autobuild@v3 | ||
|
||
- uses: actions/setup-java@v4 | ||
if: ${{ matrix.build && matrix.language == 'java' }} | ||
with: | ||
distribution: "oracle" | ||
java-version: "21" | ||
|
||
- uses: actions/cache@v3 | ||
if: ${{ matrix.build && matrix.language == 'java' }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Build | ||
if: ${{ matrix.build }} | ||
run: ${{ matrix.build }} | ||
working-directory: ${{ matrix.working-directory }} | ||
- run: | | ||
# Exclude file and build | ||
rm InstallCert.java | ||
./mvnw package -DskipTests | ||
ls -la | ||
working-directory: backend | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" | ||
- uses: github/codeql-action/analyze@v3 | ||
|
||
# https://github.com/marketplace/actions/aqua-security-trivy | ||
trivy: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,33 @@ name: PR | |
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
# PR open and close use the same group, allowing only one at a time | ||
group: pr-${{ github.workflow }}-${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
init: | ||
name: Initialize | ||
if: "!github.event.pull_request.head.repo.fork" | ||
outputs: | ||
route: ${{ steps.route.outputs.route }} | ||
route: ${{ github.event.number }} | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Get PR Number Mod 50 | ||
- name: Get FAM Route | ||
id: route | ||
run: | | ||
echo "route=$(( ${{ github.event.number }} % 50 ))" >> $GITHUB_OUTPUT | ||
echo "route=$(( ${{ github.event.number }} % 50 ))" | ||
- name: PR Greeting | ||
env: | ||
DOMAIN: apps.silver.devops.gov.bc.ca | ||
PREFIX: ${{ github.event.repository.name }}-${{ steps.route.outputs.route }} | ||
PREFIX: ${{ github.event.repository.name }} | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -38,14 +39,15 @@ jobs: | |
Thanks for the PR! | ||
Any successful deployments (not always required) will be available below. | ||
[Backend](https://${{ github.event.repository.name }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/actuator/health) | ||
[Frontend](https://${{ github.event.repository.name }}-${{ steps.route.outputs.route }}-frontend.${{ env.DOMAIN }}) | ||
Backend: https://${{ env.PREFIX }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/actuator/health | ||
Frontend: https://${{ env.PREFIX }}-${{ steps.route.outputs.route }}-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) | ||
- name: OpenShift Init | ||
uses: bcgov-nr/action-deployer-openshift@v2.0.0 | ||
uses: bcgov-nr/action-deployer-openshift@v2.1.0 | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
|
@@ -54,11 +56,12 @@ jobs: | |
overwrite: false | ||
parameters: | ||
-p ZONE=${{ github.event.number }} | ||
-p NAME=${{ github.event.repository.name }} | ||
-p AWS_KINESIS_STREAM='${{ secrets.AWS_KINESIS_STREAM }}' | ||
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}' | ||
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} | ||
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}' | ||
-p ORACLE_DB_USER=${{ secrets.DB_USER }} | ||
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}' | ||
triggers: ('common/' 'backend/' 'frontend/') | ||
|
||
builds: | ||
|
@@ -89,33 +92,29 @@ jobs: | |
deploys: | ||
name: Deploys | ||
if: "!github.event.pull_request.head.repo.fork" | ||
needs: [builds, init] | ||
needs: [builds] | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [backend, frontend, fluentbit] | ||
include: | ||
- name: backend | ||
file: backend/openshift.deploy.yml | ||
triggers: ('common/' 'backend/' 'frontend/') | ||
verification_path: /actuator/health | ||
parameters: | ||
-p MIN_REPLICAS=1 | ||
-p MAX_REPLICAS=2 | ||
- name: frontend | ||
file: frontend/openshift.deploy.yml | ||
triggers: ('common/' 'backend/' 'frontend/') | ||
parameters: | ||
-p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }} | ||
-p MIN_REPLICAS=1 | ||
-p MAX_REPLICAS=2 | ||
-p FAM_ROUTE=${{ needs.init.outputs.route }} | ||
-p FAM_ROUTE="$(( ${{ github.event.number }} % 50 ))" | ||
- name: fluentbit | ||
file: common/openshift.fluentbit.yml | ||
overwrite: true | ||
triggers: ('common/' 'backend/' 'frontend/') | ||
steps: | ||
- uses: bcgov-nr/action-deployer-openshift@v2.0.0 | ||
- uses: bcgov-nr/action-deployer-openshift@v2.1.0 | ||
with: | ||
file: ${{ matrix.file }} | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
|
@@ -124,7 +123,6 @@ jobs: | |
overwrite: true | ||
parameters: | ||
-p ZONE=${{ github.event.number }} | ||
-p NAME=${{ github.event.repository.name }} | ||
${{ matrix.parameters }} | ||
triggers: ${{ matrix.triggers }} | ||
triggers: ('common/' 'backend/' 'frontend/') | ||
verification_path: ${{ matrix.verification_path }} |
Oops, something went wrong.