From fc6528518762f5fc186bcdfc882f3fb48e4d3b45 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Sun, 30 Oct 2022 15:33:12 -0700 Subject: [PATCH] Test _build image retagging, update template paths (#58) --- .github/workflows/_deploy.yml | 2 +- .github/workflows/merge-main.yml | 12 ++++++------ .github/workflows/pr-open.yml | 29 ++++++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index 63e5652..0b01e6a 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -39,7 +39,7 @@ on: template_file: type: string required: true - description: Template file (e.g. .github/openshift/deploy.frontend.yml) + description: Template file (e.g. frontend/openshift.deploy.yml) template_vars: type: string required: true diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index 8f6cbff..10a101d 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -27,15 +27,15 @@ jobs: include: - component: database overwrite: false - template_file: .github/openshift/deploy.database.yml + template_file: database/openshift.deploy.yml template_vars: -p ZONE=test -p NAME=${{ github.event.repository.name }} - component: backend overwrite: true - template_file: .github/openshift/deploy.backend.yml + template_file: backend/openshift.deploy.yml template_vars: -p ZONE=test -p PROMOTE=${{ github.repository }}/backend:test -p NAME=${{ github.event.repository.name }} - component: frontend overwrite: true - template_file: .github/openshift/deploy.frontend.yml + template_file: frontend/openshift.deploy.yml template_vars: -p ZONE=test -p PROMOTE=${{ github.repository }}/frontend:test -p NAME=${{ github.event.repository.name }} secrets: oc_namespace: ${{ secrets.OC_NAMESPACE }} @@ -61,15 +61,15 @@ jobs: include: - component: database overwrite: false - template_file: .github/openshift/deploy.database.yml + template_file: database/openshift.deploy.yml template_vars: -p ZONE=prod -p NAME=${{ github.event.repository.name }} - component: backend overwrite: true - template_file: .github/openshift/deploy.backend.yml + template_file: backend/openshift.deploy.yml template_vars: -p ZONE=prod -p PROMOTE=${{ github.repository }}/backend:test -p NAME=${{ github.event.repository.name }} - component: frontend overwrite: true - template_file: .github/openshift/deploy.frontend.yml + template_file: frontend/openshift.deploy.yml template_vars: -p ZONE=prod -p PROMOTE=${{ github.repository }}/frontend:test -p NAME=${{ github.event.repository.name }} secrets: oc_namespace: ${{ secrets.OC_NAMESPACE }} diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index e9d2858..0837b8f 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -33,7 +33,29 @@ 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-retag: + # These build triggers won't match/fire, so images will be retagged + name: Retags + uses: ./.github/workflows/_build.yml + strategy: + matrix: + component: [backend, frontend] + include: + - component: backend + triggers: ('backend/') + - component: frontend + triggers: ('frontend/') + secrets: + gh_token: ${{ secrets.GITHUB_TOKEN }} + with: + component: ${{ matrix.component }} + img_build: ${{ github.event.number }} + img_fallback: test + repository: bcgov/nr-quickstart-typescript + triggers: ${{ matrix.triggers }} + builds: + # These builds don't have triggers and will fire every time name: Builds uses: ./.github/workflows/_build.yml strategy: @@ -62,6 +84,7 @@ jobs: name: Deploys needs: - builds + - builds-retag - tests # If any of the prerequs created a build, then deploy if: contains(needs.*.outputs.build, 'true') @@ -72,15 +95,15 @@ jobs: include: - component: database overwrite: false - template_file: .github/openshift/deploy.database.yml + template_file: database/openshift.deploy.yml template_vars: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} - component: backend overwrite: true - template_file: .github/openshift/deploy.backend.yml + template_file: backend/openshift.deploy.yml template_vars: -p ZONE=${{ github.event.number }} -p PROMOTE=${{ github.repository }}/backend:${{ github.event.number }} -p NAME=${{ github.event.repository.name }} - component: frontend overwrite: true - template_file: .github/openshift/deploy.frontend.yml + template_file: frontend/openshift.deploy.yml template_vars: -p ZONE=${{ github.event.number }} -p PROMOTE=${{ github.repository }}/frontend:${{ github.event.number }} -p NAME=${{ github.event.repository.name }} secrets: oc_namespace: ${{ secrets.OC_NAMESPACE }}