Skip to content

Commit

Permalink
Merge workflow, misc
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts committed Sep 23, 2023
1 parent 62d77ea commit 0898e21
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 97 deletions.
129 changes: 64 additions & 65 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,49 @@ concurrency:
jobs:
deploys-test:
name: TEST Deploys
env:
repo_template: bcgov/quickstart-openshift
zone: test
environment: test
runs-on: ubuntu-22.04
permissions:
issues: write
runs-on: ubuntu-22.04
strategy:
matrix:
name:
- init
- database
- backend
- backend-go
- backend-java
- backend-py
- frontend
package: [init, database, backend-go, backend-java, backend-py, frontend]
include:
- name: init
file: common/openshift.init.yml
overwrite: false
repository: ${{ env.repo_template }}
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: backend
file: backend/openshift.deploy.yml
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations:test
overwrite: true
verification_path: /api
repository: ${{ env.repo_template }}
triggers: ('backend-go' 'backend-java' 'backend-py')
- name: backend-go
file: backend-go/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-go:${{ env.zone }}
triggers: ('backend-go/')
- name: backend-java
file: backend-java/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
triggers: ('backend-java/')
- name: backend-py
file: backend-py/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:test
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:${{ env.zone }}
triggers: ('backend-py/')
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
repository: ${{ env.repo_template }}
triggers: ('database/' 'backend/' 'frontend/')
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.4.0
with:
Expand All @@ -61,13 +64,13 @@ jobs:
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
penetration_test: false
parameters:
-p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}: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_TOKEN }}
-p ZONE=${{ env.zone }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ env.zone }}
${{ matrix.parameters }}
repository: ${{ matrix.repository }}
triggers: ${{ matrix.triggers }}
verification_path: ${{ matrix.verification_path }}

integration-tests:
Expand All @@ -79,12 +82,10 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [quarkus, nest, fiber, fastapi]
name: [quarkus, fiber, fastapi]
include:
- name: quarkus
baseUrl: https://quickstart-openshift-test-backend-java.apps.silver.devops.gov.bc.ca
- name: nest
baseUrl: https://quickstart-openshift-test-backend.apps.silver.devops.gov.bc.ca
- name: fiber
baseUrl: https://quickstart-openshift-test-backend-go.apps.silver.devops.gov.bc.ca
- name: fastapi
Expand Down Expand Up @@ -161,16 +162,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
name:
- frontend
- backend
- backend-go
- backend-py
- backend-java
- database
- database-migrations
- database-migrations-go
- database-migrations-py
name: [backend-go, backend-py, backend-java, migrations-go, migrations-py]
steps:
- name: Keep last 50
uses: actions/delete-package-versions@v4
Expand All @@ -182,46 +174,50 @@ jobs:

deploys-prod:
name: PROD Deploys
needs: [integration-tests, cypress-e2e]
env:
repo_template: bcgov/quickstart-openshift
zone: prod
environment: prod
needs: [integration-tests, cypress-e2e]
permissions:
issues: write
runs-on: ubuntu-22.04
strategy:
matrix:
name:
- backend
- database
- frontend
- init
- backend-py
- backend-java
- backend-go
package: [init, database, backend-go, backend-java, backend-py, frontend]
include:
- name: backend
file: backend/openshift.deploy.yml
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations:test
overwrite: true
verification_path: /api
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
- name: init
file: common/openshift.init.yml
overwrite: false
- name: backend-py
file: backend-py/openshift.deploy.yml
repository: ${{ env.repo_template }}
- name: database
file: database/openshift.deploy.yml
overwrite: false
repository: ${{ env.repo_template }}
triggers: ('backend-go' 'backend-java' 'backend-py')
- name: backend-go
file: backend-go/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:test
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-go:${{ env.zone }}
triggers: ('backend-go/')
- name: backend-java
file: backend-java/openshift.deploy.yml
overwrite: true
- name: backend-go
file: backend-go/openshift.deploy.yml
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
triggers: ('backend-java/')
- name: backend-py
file: backend-py/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test

parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:${{ env.zone }}
triggers: ('backend-py/')
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
repository: ${{ env.repo_template }}
triggers: ('database/' 'backend/' 'frontend/')
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.4.0
with:
Expand All @@ -230,10 +226,13 @@ jobs:
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
parameters:
-p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test
-p NAME=${{ github.event.repository.name }} ${{ matrix.parameters }}
penetration_test: false
parameters:
-p ZONE=${{ env.zone }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ env.zone }}
${{ matrix.parameters }}
repository: ${{ matrix.repository }}
triggers: ${{ matrix.triggers }}
verification_path: ${{ matrix.verification_path }}

image-promotions:
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,7 @@ jobs:
packages: write
strategy:
matrix:
package:
- backend
- database
- database-migrations
- frontend
- database-migrations-py
- backend-py
- backend-java
- backend-go
- database-migrations-go
package: [backend-go, backend-java, backend-py, migrations-go, migrations-py]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ jobs:
builds:
name: Builds
if: "!github.event.pull_request.head.repo.fork"
runs-on: ubuntu-22.04
permissions:
packages: write
runs-on: ubuntu-22.04
strategy:
matrix:
package: [backend-go, backend-java, backend-py, database-migrations-go, database-migrations-py]
package: [backend-go, backend-java, backend-py, migrations-go, migrations-py]
include:
- package: backend-go
triggers: ('backend-go/')
- package: backend-java
triggers: ('backend-java/')
- package: backend-py
triggers: ('backend-py/')
- package: database-migrations-py
- package: migrations-py
triggers: ('backend-py/db')
build_context: ./backend-py/db
build_file: ./backend-py/db/Dockerfile
- package: database-migrations-go
- package: migrations-go
triggers: ('backend-go/db')
build_context: ./backend-go/db
build_file: ./backend-go/db/Dockerfile
Expand All @@ -83,33 +83,32 @@ jobs:
# https://github.com/bcgov-nr/action-deployer-openshift
deploys:
name: Deploys
env:
repo_template: bcgov/quickstart-openshift
zone: ${{ github.event.number }}
if: "!github.event.pull_request.head.repo.fork"
needs: [builds]
permissions:
issues: write
runs-on: ubuntu-22.04
strategy:
matrix:
package:
- init
- database
- backend-go
- backend-java
- backend-py
- frontend
package: [init, database, backend-go, backend-java, backend-py, frontend]
include:
- name: init
file: common/openshift.init.yml
overwrite: false
repository: bcgov/quickstart-openshift
repository: ${{ env.repo_template }}
- name: database
file: database/openshift.deploy.yml
overwrite: false
repository: bcgov/quickstart-openshift
repository: ${{ env.repo_template }}
triggers: ('backend-go' 'backend-java' 'backend-py')
- name: backend-go
file: backend-go/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:${{ github.event.number }}
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-go:${{ env.zone }}
triggers: ('backend-go/')
- name: backend-java
file: backend-java/openshift.deploy.yml
Expand All @@ -120,13 +119,13 @@ jobs:
file: backend-py/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
-p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:${{ github.event.number }}
-p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:${{ env.zone }}
triggers: ('backend-py/')
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
repository: bcgov/quickstart-openshift
repository: ${{ env.repo_template }}
triggers: ('database/' 'backend/' 'frontend/')
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.4.0
Expand All @@ -138,8 +137,8 @@ jobs:
overwrite: ${{ matrix.overwrite }}
penetration_test: false
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }}
-p ZONE=${{ env.zone }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ env.zone }}
${{ matrix.parameters }}
repository: ${{ matrix.repository }}
triggers: ${{ matrix.triggers }}
Expand Down
4 changes: 2 additions & 2 deletions backend-go/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ parameters:
value: bcgov/quickstart-openshift/backend-go:test
- name: PROMOTE_MIGRATION
description: Image (namespace/name:tag) for migration to promote/import
value: bcgov/quickstart-openshift/database-migrations-go:test
value: bcgov/quickstart-openshift/migrations-go:test
- name: COMPONENT_DB_MIGRATION
description: Component name for database migrations
value: database-migrations-go
value: migrations-go
objects:
- apiVersion: v1
kind: ImageStream
Expand Down
4 changes: 2 additions & 2 deletions backend-py/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ parameters:
value: bcgov/quickstart-openshift/backend-py:test
- name: PROMOTE_MIGRATION
description: Image (namespace/name:tag) for migration to promote/import
value: bcgov/quickstart-openshift/database-migrations-py:test
value: bcgov/quickstart-openshift/migrations-py:test
- name: COMPONENT_DB_MIGRATION
description: Component name for database migrations
value: database-migrations-py
value: migrations-py
objects:
- apiVersion: v1
kind: ConfigMap
Expand Down

0 comments on commit 0898e21

Please sign in to comment.