From 9665ce8b0bfb8a8e88ff18793ab852168652c197 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:32:43 -0700 Subject: [PATCH 1/6] Keep working on merge workflow --- .github/workflows/merge.yml | 3 +-- .github/workflows/pr-open.yml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index fc86b4e..a25240a 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,6 +1,7 @@ name: Merge on: + pull_request: workflow_run: workflows: [PR Closed] types: [completed] @@ -56,7 +57,6 @@ jobs: oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} overwrite: ${{ matrix.overwrite }} - penetration_test: false parameters: -p ZONE=test -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test @@ -167,7 +167,6 @@ jobs: oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} overwrite: ${{ matrix.overwrite }} - penetration_test: false parameters: -p ZONE=prod -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:prod diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 7b64552..440884d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -132,7 +132,6 @@ jobs: oc_server: ${{ vars.OC_SERVER }} oc_token: ${{ secrets.OC_TOKEN }} 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 }} From 66bfdcc4f9a3c9f5c25ce98e936b23547a352a50 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:37:28 -0700 Subject: [PATCH 2/6] Troubleshoot --- .github/workflows/merge.yml | 336 +++++++++++++++++----------------- .github/workflows/pr-open.yml | 4 +- 2 files changed, 168 insertions(+), 172 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index a25240a..6d9ac78 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -20,7 +20,7 @@ jobs: 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 @@ -33,21 +33,17 @@ jobs: - 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 }}/migrations-go:test + parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-go:test - name: backend-java file: backend-java/openshift.deploy.yml overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - name: backend-py file: backend-py/openshift.deploy.yml overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:test + parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:test - name: frontend file: frontend/openshift.deploy.yml overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 repository: bcgov/quickstart-openshift steps: - uses: bcgov-nr/action-deployer-openshift@v1.4.0 @@ -64,170 +60,170 @@ jobs: repository: ${{ matrix.repository }} verification_path: ${{ matrix.verification_path }} - integration-tests: - needs: [deploys-test] - name: Integration Tests for APIs - defaults: - run: - working-directory: integration-tests - runs-on: ubuntu-22.04 - strategy: - matrix: - name: [quarkus, fiber, fastapi] - include: - - name: quarkus - baseUrl: https://quickstart-openshift-backends-test-backend-java.apps.silver.devops.gov.bc.ca - - name: fiber - baseUrl: https://quickstart-openshift-backends-test-backend-go.apps.silver.devops.gov.bc.ca - - name: fastapi - baseUrl: https://quickstart-openshift-backends-test-backend-py.apps.silver.devops.gov.bc.ca - steps: - - uses: actions/checkout@v4 - name: Checkout - - name: Cache node modules - id: cache-npm - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - name: List the state of node modules - continue-on-error: true - run: npm list - - name: Install dependencies - run: npm ci - - name: Run integration tests - run: BASE_URL=${{ matrix.baseUrl }} API_NAME=${{ matrix.name }} node src/main.js + # integration-tests: + # needs: [deploys-test] + # name: Integration Tests for APIs + # defaults: + # run: + # working-directory: integration-tests + # runs-on: ubuntu-22.04 + # strategy: + # matrix: + # name: [quarkus, fiber, fastapi] + # include: + # - name: quarkus + # baseUrl: https://quickstart-openshift-backends-test-backend-java.apps.silver.devops.gov.bc.ca + # - name: fiber + # baseUrl: https://quickstart-openshift-backends-test-backend-go.apps.silver.devops.gov.bc.ca + # - name: fastapi + # baseUrl: https://quickstart-openshift-backends-test-backend-py.apps.silver.devops.gov.bc.ca + # steps: + # - uses: actions/checkout@v4 + # name: Checkout + # - name: Cache node modules + # id: cache-npm + # uses: actions/cache@v3 + # env: + # cache-name: cache-node-modules + # with: + # # npm cache files are stored in `~/.npm` on Linux/macOS + # path: ~/.npm + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # ${{ runner.os }}-build- + # ${{ runner.os }}- + # - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + # name: List the state of node modules + # continue-on-error: true + # run: npm list + # - name: Install dependencies + # run: npm ci + # - name: Run integration tests + # run: BASE_URL=${{ matrix.baseUrl }} API_NAME=${{ matrix.name }} node src/main.js - ghcr-cleanup: - name: GHCR Cleanup - runs-on: ubuntu-latest - strategy: - matrix: - name: [backend-go, backend-py, backend-java, migrations-go, migrations-py] - steps: - - name: Keep last 50 - uses: actions/delete-package-versions@v4 - with: - package-name: "${{ github.event.repository.name }}/${{ matrix.name }}" - package-type: "container" - min-versions-to-keep: 50 - ignore-versions: "^(prod|test)$" + # ghcr-cleanup: + # name: GHCR Cleanup + # runs-on: ubuntu-latest + # strategy: + # matrix: + # name: [backend-go, backend-py, backend-java, migrations-go, migrations-py] + # steps: + # - name: Keep last 50 + # uses: actions/delete-package-versions@v4 + # with: + # package-name: "${{ github.event.repository.name }}/${{ matrix.name }}" + # package-type: "container" + # min-versions-to-keep: 50 + # ignore-versions: "^(prod|test)$" - deploys-prod: - name: PROD Deploys - environment: prod - needs: [integration-tests] - permissions: - issues: write - runs-on: ubuntu-22.04 - strategy: - matrix: - package: [init, database, backend-go, backend-java, backend-py, frontend] - include: - - name: init - file: common/openshift.init.yml - overwrite: false - repository: bcgov/quickstart-openshift - - name: database - file: database/openshift.deploy.yml - overwrite: false - repository: bcgov/quickstart-openshift - - 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 }}/migrations-go:prod - - name: backend-java - file: backend-java/openshift.deploy.yml - overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - - name: backend-py - file: backend-py/openshift.deploy.yml - overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:prod - - name: frontend - file: frontend/openshift.deploy.yml - overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - repository: bcgov/quickstart-openshift - steps: - - uses: bcgov-nr/action-deployer-openshift@v1.4.0 - with: - file: ${{ matrix.file }} - oc_namespace: ${{ vars.OC_NAMESPACE }} - oc_server: ${{ vars.OC_SERVER }} - oc_token: ${{ secrets.OC_TOKEN }} - overwrite: ${{ matrix.overwrite }} - parameters: - -p ZONE=prod -p NAME=${{ github.event.repository.name }} - -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:prod - ${{ matrix.parameters }} - repository: ${{ matrix.repository }} - verification_path: ${{ matrix.verification_path }} + # deploys-prod: + # name: PROD Deploys + # environment: prod + # needs: [integration-tests] + # permissions: + # issues: write + # runs-on: ubuntu-22.04 + # strategy: + # matrix: + # package: [init, database, backend-go, backend-java, backend-py, frontend] + # include: + # - name: init + # file: common/openshift.init.yml + # overwrite: false + # repository: bcgov/quickstart-openshift + # - name: database + # file: database/openshift.deploy.yml + # overwrite: false + # repository: bcgov/quickstart-openshift + # - 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 }}/migrations-go:prod + # - name: backend-java + # file: backend-java/openshift.deploy.yml + # overwrite: true + # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + # - name: backend-py + # file: backend-py/openshift.deploy.yml + # overwrite: true + # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + # -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:prod + # - name: frontend + # file: frontend/openshift.deploy.yml + # overwrite: true + # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + # repository: bcgov/quickstart-openshift + # steps: + # - uses: bcgov-nr/action-deployer-openshift@v1.4.0 + # with: + # file: ${{ matrix.file }} + # oc_namespace: ${{ vars.OC_NAMESPACE }} + # oc_server: ${{ vars.OC_SERVER }} + # oc_token: ${{ secrets.OC_TOKEN }} + # overwrite: ${{ matrix.overwrite }} + # parameters: + # -p ZONE=prod -p NAME=${{ github.event.repository.name }} + # -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:prod + # ${{ matrix.parameters }} + # repository: ${{ matrix.repository }} + # verification_path: ${{ matrix.verification_path }} - image-promotions: - name: Promote images to PROD - needs: [deploys-prod] - runs-on: ubuntu-22.04 - permissions: - packages: write - strategy: - matrix: - component: [backend-py, backend-java, backend-go] - steps: - - uses: shrink/actions-docker-registry-tag@v3 - with: - registry: ghcr.io - repository: ${{ github.repository }}/${{ matrix.component }} - target: test - tags: prod + # image-promotions: + # name: Promote images to PROD + # needs: [deploys-prod] + # runs-on: ubuntu-22.04 + # permissions: + # packages: write + # strategy: + # matrix: + # component: [backend-py, backend-java, backend-go] + # steps: + # - uses: shrink/actions-docker-registry-tag@v3 + # with: + # registry: ghcr.io + # repository: ${{ github.repository }}/${{ matrix.component }} + # target: test + # tags: prod - generate-schema-spy: - name: Generate SchemaSpy Documentation - runs-on: ubuntu-22.04 - services: - postgres: - image: postgres - env: - POSTGRES_DB: default - POSTGRES_USER: default - POSTGRES_PASSWORD: default - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - steps: - - uses: actions/checkout@v4 - - uses: joshuaavalon/flyway-action@v3.0.0 - name: Generate SchemaSpy docs for node backend - with: - url: jdbc:postgresql://postgres:5432/default - user: default - password: default - env: - FLYWAY_VALIDATE_MIGRATION_NAMING: true - FLYWAY_LOCATIONS: filesystem:./backend/db/migrations - FLYWAY_DEFAULT_SCHEMA: "users" - - name: Create Output Folder - run: | - mkdir output - chmod a+rwx -R output - - name: Run Schemaspy - run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas users - - name: Deploy to Pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: output - target-folder: schemaspy + # generate-schema-spy: + # name: Generate SchemaSpy Documentation + # runs-on: ubuntu-22.04 + # services: + # postgres: + # image: postgres + # env: + # POSTGRES_DB: default + # POSTGRES_USER: default + # POSTGRES_PASSWORD: default + # options: >- + # --health-cmd pg_isready + # --health-interval 10s + # --health-timeout 5s + # --health-retries 5 + # ports: + # - 5432:5432 + # steps: + # - uses: actions/checkout@v4 + # - uses: joshuaavalon/flyway-action@v3.0.0 + # name: Generate SchemaSpy docs for node backend + # with: + # url: jdbc:postgresql://postgres:5432/default + # user: default + # password: default + # env: + # FLYWAY_VALIDATE_MIGRATION_NAMING: true + # FLYWAY_LOCATIONS: filesystem:./backend/db/migrations + # FLYWAY_DEFAULT_SCHEMA: "users" + # - name: Create Output Folder + # run: | + # mkdir output + # chmod a+rwx -R output + # - name: Run Schemaspy + # run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas users + # - name: Deploy to Pages + # uses: JamesIves/github-pages-deploy-action@v4 + # with: + # folder: output + # target-folder: schemaspy diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 440884d..992e844 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -1,8 +1,8 @@ name: PR on: - pull_request: - branches: [main] + # pull_request: + # branches: [main] workflow_dispatch: concurrency: From dadc4a682950dbbab024b04cad96181c33585034 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:41:53 -0700 Subject: [PATCH 3/6] Troubleshoot --- .github/workflows/merge.yml | 12 ++---------- .github/workflows/pr-open.yml | 6 +----- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 6d9ac78..3264a80 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -20,12 +20,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - # package: [init, database, backend-go, backend-java, backend-py, frontend] + package: [database, backend-go, backend-java, backend-py, frontend] include: - - name: init - file: common/openshift.init.yml - overwrite: false - repository: bcgov/quickstart-openshift - name: database file: database/openshift.deploy.yml overwrite: false @@ -126,12 +122,8 @@ jobs: # runs-on: ubuntu-22.04 # strategy: # matrix: - # package: [init, database, backend-go, backend-java, backend-py, frontend] + # package: [database, backend-go, backend-java, backend-py, frontend] # include: - # - name: init - # file: common/openshift.init.yml - # overwrite: false - # repository: bcgov/quickstart-openshift # - name: database # file: database/openshift.deploy.yml # overwrite: false diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 992e844..a2a3103 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -90,12 +90,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - package: [init, database, backend-go, backend-java, backend-py, frontend] + package: [database, backend-go, backend-java, backend-py, frontend] include: - - name: init - file: common/openshift.init.yml - overwrite: false - repository: bcgov/quickstart-openshift - name: database file: database/openshift.deploy.yml overwrite: false From 129969931f9c21f4260e8eee9a035d391cff55d9 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:51:21 -0700 Subject: [PATCH 4/6] Troubleshoot --- .github/workflows/merge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 3264a80..c0d17d1 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - package: [database, backend-go, backend-java, backend-py, frontend] + name: [database, backend-go, backend-java, backend-py, frontend] include: - name: database file: database/openshift.deploy.yml @@ -122,7 +122,7 @@ jobs: # runs-on: ubuntu-22.04 # strategy: # matrix: - # package: [database, backend-go, backend-java, backend-py, frontend] + # name: [database, backend-go, backend-java, backend-py, frontend] # include: # - name: database # file: database/openshift.deploy.yml From 349383c96399de0d31e0457b0a3017da283bc039 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:58:41 -0700 Subject: [PATCH 5/6] Corrections --- .github/workflows/merge.yml | 318 ++++++++++++++++----------------- .github/workflows/pr-close.yml | 2 +- .github/workflows/pr-open.yml | 2 +- 3 files changed, 161 insertions(+), 161 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index c0d17d1..8088bdf 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -56,166 +56,166 @@ jobs: repository: ${{ matrix.repository }} verification_path: ${{ matrix.verification_path }} - # integration-tests: - # needs: [deploys-test] - # name: Integration Tests for APIs - # defaults: - # run: - # working-directory: integration-tests - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # name: [quarkus, fiber, fastapi] - # include: - # - name: quarkus - # baseUrl: https://quickstart-openshift-backends-test-backend-java.apps.silver.devops.gov.bc.ca - # - name: fiber - # baseUrl: https://quickstart-openshift-backends-test-backend-go.apps.silver.devops.gov.bc.ca - # - name: fastapi - # baseUrl: https://quickstart-openshift-backends-test-backend-py.apps.silver.devops.gov.bc.ca - # steps: - # - uses: actions/checkout@v4 - # name: Checkout - # - name: Cache node modules - # id: cache-npm - # uses: actions/cache@v3 - # env: - # cache-name: cache-node-modules - # with: - # # npm cache files are stored in `~/.npm` on Linux/macOS - # path: ~/.npm - # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - # restore-keys: | - # ${{ runner.os }}-build-${{ env.cache-name }}- - # ${{ runner.os }}-build- - # ${{ runner.os }}- - # - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - # name: List the state of node modules - # continue-on-error: true - # run: npm list - # - name: Install dependencies - # run: npm ci - # - name: Run integration tests - # run: BASE_URL=${{ matrix.baseUrl }} API_NAME=${{ matrix.name }} node src/main.js + integration-tests: + needs: [deploys-test] + name: Integration Tests for APIs + defaults: + run: + working-directory: integration-tests + runs-on: ubuntu-22.04 + strategy: + matrix: + name: [quarkus, fiber, fastapi] + include: + - name: quarkus + baseUrl: https://quickstart-openshift-backends-test-backend-java.apps.silver.devops.gov.bc.ca + - name: fiber + baseUrl: https://quickstart-openshift-backends-test-backend-go.apps.silver.devops.gov.bc.ca + - name: fastapi + baseUrl: https://quickstart-openshift-backends-test-backend-py.apps.silver.devops.gov.bc.ca + steps: + - uses: actions/checkout@v4 + name: Checkout + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Install dependencies + run: npm ci + - name: Run integration tests + run: BASE_URL=${{ matrix.baseUrl }} API_NAME=${{ matrix.name }} node src/main.js - # ghcr-cleanup: - # name: GHCR Cleanup - # runs-on: ubuntu-latest - # strategy: - # matrix: - # name: [backend-go, backend-py, backend-java, migrations-go, migrations-py] - # steps: - # - name: Keep last 50 - # uses: actions/delete-package-versions@v4 - # with: - # package-name: "${{ github.event.repository.name }}/${{ matrix.name }}" - # package-type: "container" - # min-versions-to-keep: 50 - # ignore-versions: "^(prod|test)$" + ghcr-cleanup: + name: GHCR Cleanup + runs-on: ubuntu-latest + strategy: + matrix: + name: [backend-go, backend-py, backend-java, migrations-go, migrations-py] + steps: + - name: Keep last 50 + uses: actions/delete-package-versions@v4 + with: + package-name: "${{ github.event.repository.name }}/${{ matrix.name }}" + package-type: "container" + min-versions-to-keep: 50 + ignore-versions: "^(prod|test)$" - # deploys-prod: - # name: PROD Deploys - # environment: prod - # needs: [integration-tests] - # permissions: - # issues: write - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # name: [database, backend-go, backend-java, backend-py, frontend] - # include: - # - name: database - # file: database/openshift.deploy.yml - # overwrite: false - # repository: bcgov/quickstart-openshift - # - 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 }}/migrations-go:prod - # - name: backend-java - # file: backend-java/openshift.deploy.yml - # overwrite: true - # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - # - name: backend-py - # file: backend-py/openshift.deploy.yml - # overwrite: true - # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - # -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:prod - # - name: frontend - # file: frontend/openshift.deploy.yml - # overwrite: true - # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - # repository: bcgov/quickstart-openshift - # steps: - # - uses: bcgov-nr/action-deployer-openshift@v1.4.0 - # with: - # file: ${{ matrix.file }} - # oc_namespace: ${{ vars.OC_NAMESPACE }} - # oc_server: ${{ vars.OC_SERVER }} - # oc_token: ${{ secrets.OC_TOKEN }} - # overwrite: ${{ matrix.overwrite }} - # parameters: - # -p ZONE=prod -p NAME=${{ github.event.repository.name }} - # -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:prod - # ${{ matrix.parameters }} - # repository: ${{ matrix.repository }} - # verification_path: ${{ matrix.verification_path }} + deploys-prod: + name: PROD Deploys + environment: prod + needs: [integration-tests] + permissions: + issues: write + runs-on: ubuntu-22.04 + strategy: + matrix: + name: [database, backend-go, backend-java, backend-py, frontend] + include: + - name: database + file: database/openshift.deploy.yml + overwrite: false + repository: bcgov/quickstart-openshift + - 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 }}/migrations-go:prod + - name: backend-java + file: backend-java/openshift.deploy.yml + overwrite: true + parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + - name: backend-py + file: backend-py/openshift.deploy.yml + overwrite: true + parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + -p PROMOTE_MIGRATION=${{ github.repository }}/migrations-py:prod + - name: frontend + file: frontend/openshift.deploy.yml + overwrite: true + parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + repository: bcgov/quickstart-openshift + steps: + - uses: bcgov-nr/action-deployer-openshift@v1.4.0 + with: + file: ${{ matrix.file }} + oc_namespace: ${{ vars.OC_NAMESPACE }} + oc_server: ${{ vars.OC_SERVER }} + oc_token: ${{ secrets.OC_TOKEN }} + overwrite: ${{ matrix.overwrite }} + parameters: + -p ZONE=prod -p NAME=${{ github.event.repository.name }} + -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:prod + ${{ matrix.parameters }} + repository: ${{ matrix.repository }} + verification_path: ${{ matrix.verification_path }} - # image-promotions: - # name: Promote images to PROD - # needs: [deploys-prod] - # runs-on: ubuntu-22.04 - # permissions: - # packages: write - # strategy: - # matrix: - # component: [backend-py, backend-java, backend-go] - # steps: - # - uses: shrink/actions-docker-registry-tag@v3 - # with: - # registry: ghcr.io - # repository: ${{ github.repository }}/${{ matrix.component }} - # target: test - # tags: prod + image-promotions: + name: Promote images to PROD + needs: [deploys-prod] + runs-on: ubuntu-22.04 + permissions: + packages: write + strategy: + matrix: + component: [backend-py, backend-java, backend-go] + steps: + - uses: shrink/actions-docker-registry-tag@v3 + with: + registry: ghcr.io + repository: ${{ github.repository }}/${{ matrix.component }} + target: test + tags: prod - # generate-schema-spy: - # name: Generate SchemaSpy Documentation - # runs-on: ubuntu-22.04 - # services: - # postgres: - # image: postgres - # env: - # POSTGRES_DB: default - # POSTGRES_USER: default - # POSTGRES_PASSWORD: default - # options: >- - # --health-cmd pg_isready - # --health-interval 10s - # --health-timeout 5s - # --health-retries 5 - # ports: - # - 5432:5432 - # steps: - # - uses: actions/checkout@v4 - # - uses: joshuaavalon/flyway-action@v3.0.0 - # name: Generate SchemaSpy docs for node backend - # with: - # url: jdbc:postgresql://postgres:5432/default - # user: default - # password: default - # env: - # FLYWAY_VALIDATE_MIGRATION_NAMING: true - # FLYWAY_LOCATIONS: filesystem:./backend/db/migrations - # FLYWAY_DEFAULT_SCHEMA: "users" - # - name: Create Output Folder - # run: | - # mkdir output - # chmod a+rwx -R output - # - name: Run Schemaspy - # run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas users - # - name: Deploy to Pages - # uses: JamesIves/github-pages-deploy-action@v4 - # with: - # folder: output - # target-folder: schemaspy + generate-schema-spy: + name: Generate SchemaSpy Documentation + runs-on: ubuntu-22.04 + services: + postgres: + image: postgres + env: + POSTGRES_DB: default + POSTGRES_USER: default + POSTGRES_PASSWORD: default + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v4 + - uses: joshuaavalon/flyway-action@v3.0.0 + name: Generate SchemaSpy docs for node backend + with: + url: jdbc:postgresql://postgres:5432/default + user: default + password: default + env: + FLYWAY_VALIDATE_MIGRATION_NAMING: true + FLYWAY_LOCATIONS: filesystem:./backend/db/migrations + FLYWAY_DEFAULT_SCHEMA: "users" + - name: Create Output Folder + run: | + mkdir output + chmod a+rwx -R output + - name: Run Schemaspy + run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas users + - name: Deploy to Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: output + target-folder: schemaspy diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index 68bb1ae..86e4bfb 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -34,7 +34,7 @@ jobs: packages: write strategy: matrix: - package: [backend-go, backend-java, backend-py, migrations-go, migrations-py] + package: [database, backend-go, backend-java, backend-py, migrations-go, migrations-py, frontend] steps: - uses: shrink/actions-docker-registry-tag@v3 with: diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index a2a3103..28dabc8 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -90,7 +90,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - package: [database, backend-go, backend-java, backend-py, frontend] + name: [database, backend-go, backend-java, backend-py, frontend] include: - name: database file: database/openshift.deploy.yml From c9d3c78e83fdd85aff75e1a3aa14fd5c59008d12 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sat, 23 Sep 2023 12:59:42 -0700 Subject: [PATCH 6/6] Restore workflows --- .github/workflows/merge.yml | 1 - .github/workflows/pr-open.yml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 8088bdf..4815bf2 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,7 +1,6 @@ name: Merge on: - pull_request: workflow_run: workflows: [PR Closed] types: [completed] diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 28dabc8..88e913d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -1,8 +1,8 @@ name: PR on: - # pull_request: - # branches: [main] + pull_request: + branches: [main] workflow_dispatch: concurrency: