From 6cd04d3a38b62f30f4e0d937e9e28b4087939e3b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 19 Nov 2024 15:34:09 -0800 Subject: [PATCH 1/3] ci: pr-validate job --- .github/workflows/pr-open.yml | 20 ---------------- .github/workflows/pr-validate.yml | 40 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/pr-validate.yml diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 58be5129..7d87b0bb 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -26,26 +26,6 @@ jobs: run: | echo "route=$(( ${{ github.event.number }} % 50 ))" >> $GITHUB_OUTPUT - - name: PR Greeting - env: - DOMAIN: apps.silver.devops.gov.bc.ca - PREFIX: ${{ github.event.repository.name }} - uses: bcgov-nr/action-pr-description-add@v1.1.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - add_markdown: | - --- - - Thanks for the PR! - - Any successful deployments (not always required) will be available below. - - 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@v3.0.1 with: diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml new file mode 100644 index 00000000..26e7f09e --- /dev/null +++ b/.github/workflows/pr-validate.yml @@ -0,0 +1,40 @@ +name: PR Validate + +on: + pull_request: + types: [edited, opened, synchronize, reopened, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-edit-${{ github.event.number }} + cancel-in-progress: true + +jobs: + init: + name: Initialize + outputs: + mod-tag: ${{ steps.mod-tag.outputs.mod-tag }} + runs-on: ubuntu-24.04 + steps: + - name: Get PR Number Mod 50 + id: mod-tag + run: echo "mod-tag=$(( ${{ github.event.number }} % 50 ))" >> $GITHUB_OUTPUT + + validate: + name: Validate PR + env: + DOMAIN: apps.silver.devops.gov.bc.ca + PREFIX: ${{ github.event.repository.name }} + needs: [init] + uses: bcgov/quickstart-openshift-helpers/.github/workflows/.pr-validate.yml@v0.8.3 + with: + markdown_links: | + - [Backend](https://${{ env.PREFIX }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/actuator/health) + - [Frontend](https://${{ env.PREFIX }}-${{ steps.route.outputs.mod-tag }}-frontend.${{ env.DOMAIN }}) + + results: + name: Validate Results + if: always() && (!failure()) && (!cancelled()) + needs: [validate] + runs-on: ubuntu-24.04 + steps: + - run: echo "Success!" From dfcc3ebb630bc45445327e2c5df45b7547b9425c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 19 Nov 2024 15:39:40 -0800 Subject: [PATCH 2/3] Fix env --- .github/workflows/pr-validate.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml index 26e7f09e..cb964a35 100644 --- a/.github/workflows/pr-validate.yml +++ b/.github/workflows/pr-validate.yml @@ -21,15 +21,12 @@ jobs: validate: name: Validate PR - env: - DOMAIN: apps.silver.devops.gov.bc.ca - PREFIX: ${{ github.event.repository.name }} needs: [init] uses: bcgov/quickstart-openshift-helpers/.github/workflows/.pr-validate.yml@v0.8.3 with: markdown_links: | - - [Backend](https://${{ env.PREFIX }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/actuator/health) - - [Frontend](https://${{ env.PREFIX }}-${{ steps.route.outputs.mod-tag }}-frontend.${{ env.DOMAIN }}) + - [Backend](https://${{ github.event.repository.name }}-${{ github.event.number }}-backend.apps.silver.devops.gov.bc.ca/actuator/health) + - [Frontend](https://${{ github.event.repository.name }}-${{ steps.route.outputs.mod-tag }}-frontend.apps.silver.devops.gov.bc.ca) results: name: Validate Results From a5cd81b7224627aa8f9157afb86b6d4819b20a57 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 19 Nov 2024 15:40:51 -0800 Subject: [PATCH 3/3] Fix needs...mod-tag --- .github/workflows/pr-validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml index cb964a35..6110d8fc 100644 --- a/.github/workflows/pr-validate.yml +++ b/.github/workflows/pr-validate.yml @@ -26,7 +26,7 @@ jobs: with: markdown_links: | - [Backend](https://${{ github.event.repository.name }}-${{ github.event.number }}-backend.apps.silver.devops.gov.bc.ca/actuator/health) - - [Frontend](https://${{ github.event.repository.name }}-${{ steps.route.outputs.mod-tag }}-frontend.apps.silver.devops.gov.bc.ca) + - [Frontend](https://${{ github.event.repository.name }}-${{ needs.init.outputs.mod-tag }}-frontend.apps.silver.devops.gov.bc.ca) results: name: Validate Results