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.
* fix: merge main workflow name * feat: add postgres blank database jira task 221 * test: add application properties for test * ci: add files and workflows for databse deploy jira issue 221 * ci: fix workflow parameters * ci: fix matrix name vars
- Loading branch information
Ricardo Campos
authored
Nov 6, 2023
1 parent
9839c8d
commit e679b74
Showing
11 changed files
with
456 additions
and
20 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 |
---|---|---|
|
@@ -34,21 +34,43 @@ jobs: | |
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
|
||
init-test: | ||
name: TEST Init | ||
environment: test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: OpenShift Init | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
file: common/openshift.init.yml | ||
overwrite: false | ||
parameters: | ||
-p ZONE=test -p NAME=${{ github.event.repository.name }} | ||
|
||
deploys-test: | ||
name: TEST Deployments | ||
needs: [init-test] | ||
environment: test | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
issues: write | ||
strategy: | ||
matrix: | ||
name: [backend, frontend] | ||
name: [database, backend, frontend] | ||
include: | ||
- name: database | ||
- name: backend | ||
parameters: | ||
-p PROMOTE=${{ github.repository }}/backend:test | ||
verification_path: "actuator/health" | ||
- 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 }} | ||
-p PROMOTE=${{ github.repository }}/frontend:test | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
|
@@ -58,29 +80,51 @@ jobs: | |
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: true | ||
parameters: | ||
-p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test | ||
-p ZONE=test | ||
-p NAME=${{ github.event.repository.name }} | ||
${{ matrix.parameters }} | ||
penetration_test: true | ||
penetration_test_artifact: ${{ matrix.name }} | ||
penetration_test_issue: ${{ matrix.name }} | ||
penetration_test_token: ${{ secrets.GITHUB_SECRET }} | ||
|
||
init-prod: | ||
name: PROD Init | ||
needs: [deploys-test] | ||
environment: prod | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: OpenShift Init | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
file: common/openshift.init.yml | ||
overwrite: false | ||
parameters: | ||
-p ZONE=prod -p NAME=${{ github.event.repository.name }} | ||
|
||
deploys-prod: | ||
name: PROD Deployments | ||
needs: [deploys-test] | ||
needs: [init-prod] | ||
environment: prod | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [backend, frontend] | ||
name: [database, backend, frontend] | ||
include: | ||
- name: database | ||
- name: backend | ||
parameters: | ||
-p PROMOTE=${{ github.repository }}/backend:test | ||
- name: frontend | ||
parameters: | ||
-p PROMOTE=${{ github.repository }}/frontend:test | ||
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/[email protected] | ||
with: | ||
|
@@ -90,19 +134,23 @@ jobs: | |
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: true | ||
parameters: | ||
-p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test | ||
-p ZONE=prod | ||
-p NAME=${{ github.event.repository.name }} | ||
${{ matrix.parameters }} | ||
|
||
image-promotions: | ||
name: Promote images to PROD | ||
needs: [deploys-prod] | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
strategy: | ||
matrix: | ||
component: [database, backend, frontend] | ||
steps: | ||
- uses: shrink/actions-docker-registry-tag@v3 | ||
with: | ||
registry: ghcr.io | ||
repository: ${{ github.repository }}/frontend | ||
repository: ${{ github.repository }}/${{ matrix.component }} | ||
target: test | ||
tags: prod |
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 |
---|---|---|
|
@@ -37,16 +37,32 @@ 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) | ||
- name: OpenShift Init | ||
uses: bcgov-nr/[email protected] | ||
with: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
file: common/openshift.init.yml | ||
overwrite: false | ||
parameters: | ||
-p ZONE=${{ github.event.number }} | ||
-p NAME=${{ github.event.repository.name }} | ||
triggers: ('common/' 'database/' 'backend/' 'frontend/') | ||
|
||
builds: | ||
name: Builds | ||
needs: [pr-greeting] | ||
if: "!github.event.pull_request.head.repo.fork" | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
strategy: | ||
matrix: | ||
name: [backend, frontend] | ||
name: [database, backend, frontend] | ||
include: | ||
- package: database | ||
triggers: ('database/') | ||
- name: backend | ||
triggers: ('backend/') | ||
- name: frontend | ||
|
@@ -64,22 +80,35 @@ jobs: | |
deploys: | ||
name: Deploys | ||
if: "!github.event.pull_request.head.repo.fork" | ||
needs: [builds] | ||
needs: [builds, pr-greeting] | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [backend, frontend] | ||
name: [database, backend, frontend] | ||
include: | ||
- name: database | ||
file: database/openshift.deploy.yml | ||
parameters: | ||
-p DB_PVC_SIZE=128Mi | ||
overwrite: false | ||
triggers: ('common/' 'database/' 'backend/' 'frontend/') | ||
- name: backend | ||
file: backend/openshift.deploy.yml | ||
triggers: ('backend/' 'frontend/') | ||
triggers: ('common/' 'database/' 'backend/' 'frontend/') | ||
verification_path: /actuator/health | ||
parameters: | ||
-p PROMOTE=${{ github.repository }}/backend:${{ github.event.number }} | ||
-p MIN_REPLICAS=1 | ||
-p MAX_REPLICAS=2 | ||
- name: frontend | ||
file: frontend/openshift.deploy.yml | ||
triggers: ('backend/' 'frontend/') | ||
triggers: ('common/' 'database/' '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 }} | ||
-p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }} | ||
-p MIN_REPLICAS=1 | ||
-p MAX_REPLICAS=2 | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
|
@@ -89,9 +118,8 @@ jobs: | |
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: true | ||
parameters: | ||
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} | ||
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }} | ||
-p MIN_REPLICAS=1 -p MAX_REPLICAS=2 | ||
-p ZONE=${{ github.event.number }} | ||
-p NAME=${{ github.event.repository.name }} | ||
${{ matrix.parameters }} | ||
triggers: ${{ matrix.triggers }} | ||
verification_path: ${{ matrix.verification_path }} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE SCHEMA IF NOT EXISTS silva; | ||
|
||
-- Example | ||
CREATE TABLE IF NOT EXISTS silva.person ( | ||
id INT NOT NULL, | ||
name VARCHAR(30) NOT NULL, | ||
CONSTRAINT person_pk | ||
PRIMARY KEY(id) | ||
); | ||
|
||
DROP TABLE silva.person; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Server and application | ||
spring.profiles.active = dev | ||
|
||
# Database, datasource and JPA | ||
spring.datasource.driverClassName=org.h2.Driver | ||
spring.datasource.url=jdbc:h2:mem:silvadb;DB_CLOSE_DELAY=-1;NON_KEYWORDS=USER;DB_CLOSE_ON_EXIT=true | ||
spring.datasource.username=result | ||
spring.datasource.password=password | ||
spring.datasource.initialization-mode=always | ||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect | ||
spring.jpa.show-sql=true | ||
spring.jpa.hibernate.generate-ddl = true | ||
spring.jpa.hibernate.ddl-auto = create-drop |
Oops, something went wrong.