From 8a5333f33c38f180ebb3a9473f59b17fc6cb07d2 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 12 Oct 2023 14:15:23 -0600 Subject: [PATCH 01/15] a test file to run on PR to find any obvious issues, and then a rollout to test and prod on workflow dispatch --- .github/workflows/core-api.deploy.prod.yaml | 4 ++++ .github/workflows/core-api.deploy.test.yaml | 4 ++++ .github/workflows/testing-workflow.yaml | 22 +++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 .github/workflows/testing-workflow.yaml diff --git a/.github/workflows/core-api.deploy.prod.yaml b/.github/workflows/core-api.deploy.prod.yaml index d045471fe9..357c2ec152 100644 --- a/.github/workflows/core-api.deploy.prod.yaml +++ b/.github/workflows/core-api.deploy.prod.yaml @@ -33,6 +33,10 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} + - name: Restart SchemaSpy pods + run: | + oc -n 4c2ba9-prod rollout restart deployment/schemaspy + trigger-gitops: runs-on: ubuntu-20.04 timeout-minutes: 10 diff --git a/.github/workflows/core-api.deploy.test.yaml b/.github/workflows/core-api.deploy.test.yaml index 3d023747ff..8ce98ff118 100644 --- a/.github/workflows/core-api.deploy.test.yaml +++ b/.github/workflows/core-api.deploy.test.yaml @@ -32,6 +32,10 @@ jobs: oc -n ${{secrets.NS_TOOLS}} tag \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} + + - name: Restart SchemaSpy pods + run: | + oc -n 4c2ba9-test rollout restart deployment/schemaspy trigger-gitops: runs-on: ubuntu-20.04 diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml new file mode 100644 index 0000000000..da0ea78e63 --- /dev/null +++ b/.github/workflows/testing-workflow.yaml @@ -0,0 +1,22 @@ +name: Testing this as part of a workflow + +on: + pull_request: + +jobs: + test-schemaspy-rollout: + name: test-schemaspy-rollout + runs-on: ubuntu-20.04 + steps: + - name: Install oc + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4.7" + + - name: oc login + run: | + oc login --token=${{ secrets.BUILD_TOKEN }} --server=${{ secrets.CLUSTER_API }} + + - name: Restart SchemaSpy pods + run: | + oc -n 4c2ba9-dev rollout restart deployment/schemaspy \ No newline at end of file From 8de7ca2853c3363fba745758041ddfdf5e9031f0 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 12 Oct 2023 14:50:09 -0600 Subject: [PATCH 02/15] testing reuse of watch-deployment --- .github/workflows/testing-workflow.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index da0ea78e63..070e80eb35 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -19,4 +19,7 @@ jobs: - name: Restart SchemaSpy pods run: | - oc -n 4c2ba9-dev rollout restart deployment/schemaspy \ No newline at end of file + oc -n 4c2ba9-dev rollout restart deployment/schemaspy + + - name: Notification + run: ./gitops/watch-deployment.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} \ No newline at end of file From ddcc56f2f8ae68d8637c530489ac84528a52866e Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 12 Oct 2023 14:57:06 -0600 Subject: [PATCH 03/15] hey why can't you find my file --- .github/workflows/testing-workflow.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index 070e80eb35..5a575cf492 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -22,4 +22,7 @@ jobs: oc -n 4c2ba9-dev rollout restart deployment/schemaspy - name: Notification - run: ./gitops/watch-deployment.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} \ No newline at end of file + run: | + pwd + ls -a + ./gitops/watch-deployment.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} \ No newline at end of file From 91ad39b3ace6c15c5cbe9fbb191d972143e368f7 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 12 Oct 2023 15:00:19 -0600 Subject: [PATCH 04/15] give it the repo so it can use script files --- .github/workflows/testing-workflow.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index 5a575cf492..fe30fe313c 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -17,6 +17,9 @@ jobs: run: | oc login --token=${{ secrets.BUILD_TOKEN }} --server=${{ secrets.CLUSTER_API }} + - name: Checkout + uses: actions/checkout@v3 + - name: Restart SchemaSpy pods run: | oc -n 4c2ba9-dev rollout restart deployment/schemaspy From 463a3877f1ceab7e98c8d5253912407ada4b11e9 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 12 Oct 2023 15:51:54 -0600 Subject: [PATCH 05/15] get rid of unnecessary test parts, add in argocd --- .github/workflows/testing-workflow.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index fe30fe313c..ed95690c1e 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -19,13 +19,16 @@ jobs: - name: Checkout uses: actions/checkout@v3 - + - name: Restart SchemaSpy pods run: | oc -n 4c2ba9-dev rollout restart deployment/schemaspy + - name: Setup ArgoCD CLI + uses: imajeetyadav/argocd-cli@v1 + with: + version: v2.7.9 # optional + - name: Notification run: | - pwd - ls -a ./gitops/watch-deployment.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} \ No newline at end of file From 6d4242614223b679978ffd8ddc4912606bdcc9e1 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Fri, 13 Oct 2023 09:49:10 -0600 Subject: [PATCH 06/15] testing to see if rollout status holds up discord notification --- .github/workflows/testing-workflow.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index ed95690c1e..eb39898779 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -23,12 +23,10 @@ jobs: - name: Restart SchemaSpy pods run: | oc -n 4c2ba9-dev rollout restart deployment/schemaspy + + - name: Watch Rollout Status + run: | + oc -n 4c2ba9-dev rollout status deployment/schemaspy - - name: Setup ArgoCD CLI - uses: imajeetyadav/argocd-cli@v1 - with: - version: v2.7.9 # optional - - name: Notification - run: | - ./gitops/watch-deployment.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} \ No newline at end of file + run: ./gitops/notify_discord.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 \ No newline at end of file From 4e3d0c33f41dcd66c44e878ed3f329f68be70229 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Fri, 13 Oct 2023 10:24:09 -0600 Subject: [PATCH 07/15] add failure notification on timeout --- .github/workflows/testing-workflow.yaml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index eb39898779..4ebe8029c3 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -3,9 +3,12 @@ name: Testing this as part of a workflow on: pull_request: +env: + ENVIRONMENT: dev + jobs: test-schemaspy-rollout: - name: test-schemaspy-rollout + name: test-schemaspy-rollout runs-on: ubuntu-20.04 steps: - name: Install oc @@ -22,11 +25,17 @@ jobs: - name: Restart SchemaSpy pods run: | - oc -n 4c2ba9-dev rollout restart deployment/schemaspy + oc -n 4c2ba9-${{ env.ENVIRONMENT }} rollout restart deployment/schemaspy - - name: Watch Rollout Status + - name: Watch Rollout Status run: | - oc -n 4c2ba9-dev rollout status deployment/schemaspy + oc -n 4c2ba9-{{ env.ENVIRONMENT }} rollout status deployment/schemaspy + timeout-minutes: 10 - - name: Notification - run: ./gitops/notify_discord.sh schemaspy dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 \ No newline at end of file + - name: Notify Discord of Rollout success + if: ${{ success() }} + run: ./gitops/notify_discord.sh schemaspy {{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 + + - name: Notify Discord of Rollout failure + if: ${{ failure() }} + run: ./gitops/notify_discord.sh schemaspy {{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 From c7c5bcab2a3707fa15c200e3b903a024a9a6a5b8 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Fri, 13 Oct 2023 10:27:35 -0600 Subject: [PATCH 08/15] syntax error --- .github/workflows/testing-workflow.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/testing-workflow.yaml index 4ebe8029c3..794a052b66 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/testing-workflow.yaml @@ -29,13 +29,13 @@ jobs: - name: Watch Rollout Status run: | - oc -n 4c2ba9-{{ env.ENVIRONMENT }} rollout status deployment/schemaspy + oc -n 4c2ba9-${{ env.ENVIRONMENT }} rollout status deployment/schemaspy timeout-minutes: 10 - name: Notify Discord of Rollout success if: ${{ success() }} - run: ./gitops/notify_discord.sh schemaspy {{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 + run: ./gitops/notify_discord.sh schemaspy ${{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 - name: Notify Discord of Rollout failure if: ${{ failure() }} - run: ./gitops/notify_discord.sh schemaspy {{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 + run: ./gitops/notify_discord.sh schemaspy ${{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 From 681885a18e9cb0f6026b6706247420c73db107e4 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 10:20:42 -0600 Subject: [PATCH 09/15] test reusable workflow --- .github/workflows/schemaspy-rollout-dev.yaml | 17 +++++++++++++++++ ...ing-workflow.yaml => schemaspy-rollout.yaml} | 17 +++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/schemaspy-rollout-dev.yaml rename .github/workflows/{testing-workflow.yaml => schemaspy-rollout.yaml} (58%) diff --git a/.github/workflows/schemaspy-rollout-dev.yaml b/.github/workflows/schemaspy-rollout-dev.yaml new file mode 100644 index 0000000000..db285f81cf --- /dev/null +++ b/.github/workflows/schemaspy-rollout-dev.yaml @@ -0,0 +1,17 @@ +name: SchemaSpy - DEV restart rollout + +on: + pull_request: + workflow_dispatch: + push: + branches: + - develop + paths: + - migrations/sql + +jobs: + dev-schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout.yaml + with: + environment: dev + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/testing-workflow.yaml b/.github/workflows/schemaspy-rollout.yaml similarity index 58% rename from .github/workflows/testing-workflow.yaml rename to .github/workflows/schemaspy-rollout.yaml index 794a052b66..763b3f1004 100644 --- a/.github/workflows/testing-workflow.yaml +++ b/.github/workflows/schemaspy-rollout.yaml @@ -1,10 +1,11 @@ name: Testing this as part of a workflow on: - pull_request: - -env: - ENVIRONMENT: dev + workflow_call: + inputs: + environment: + required: true + type: string jobs: test-schemaspy-rollout: @@ -25,17 +26,17 @@ jobs: - name: Restart SchemaSpy pods run: | - oc -n 4c2ba9-${{ env.ENVIRONMENT }} rollout restart deployment/schemaspy + oc -n 4c2ba9-${{ inputs.environment }} rollout restart deployment/schemaspy - name: Watch Rollout Status run: | - oc -n 4c2ba9-${{ env.ENVIRONMENT }} rollout status deployment/schemaspy + oc -n 4c2ba9-${{ inputs.environment }} rollout status deployment/schemaspy timeout-minutes: 10 - name: Notify Discord of Rollout success if: ${{ success() }} - run: ./gitops/notify_discord.sh schemaspy ${{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 + run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 - name: Notify Discord of Rollout failure if: ${{ failure() }} - run: ./gitops/notify_discord.sh schemaspy ${{ env.ENVIRONMENT }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 + run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 From 9950891be5aa3129c4e6bf61b42d344a00536ad9 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:15:20 -0600 Subject: [PATCH 10/15] some environment-specific workflows that call the reusable one, call it from core-api deploy workflows, and try to fix run-if-failed --- .github/workflows/core-api.build.deploy.dev.yaml | 7 +++++-- .github/workflows/core-api.deploy.prod.yaml | 9 ++++----- .github/workflows/core-api.deploy.test.yaml | 9 ++++----- .github/workflows/schemaspy-rollout-dev.yaml | 7 +------ .github/workflows/schemaspy-rollout-prod.yaml | 12 ++++++++++++ .github/workflows/schemaspy-rollout-test.yaml | 12 ++++++++++++ .github/workflows/schemaspy-rollout.yaml | 4 ++-- 7 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/schemaspy-rollout-prod.yaml create mode 100644 .github/workflows/schemaspy-rollout-test.yaml diff --git a/.github/workflows/core-api.build.deploy.dev.yaml b/.github/workflows/core-api.build.deploy.dev.yaml index ee6e489b66..5489fb2275 100644 --- a/.github/workflows/core-api.build.deploy.dev.yaml +++ b/.github/workflows/core-api.build.deploy.dev.yaml @@ -52,6 +52,9 @@ jobs: - name: Push run: | docker push --all-tags ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.MIG }} + - name: SchemaSpy Rollout + uses: ./.github/workflows/schemaspy-rollout-dev.yaml + trigger-gitops: runs-on: ubuntu-20.04 @@ -77,8 +80,8 @@ jobs: run-if-failed: runs-on: ubuntu-20.04 - needs: [trigger-gitops] - if: always() && (needs.trigger-gitops.result == 'failure') + needs: [build-backend, build-flyway, trigger-gitops] + if: ${{ always() && contains(needs.*.result, 'failure') }} steps: - name: Notification run: ./gitops/watch-deployment.sh core-api dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 diff --git a/.github/workflows/core-api.deploy.prod.yaml b/.github/workflows/core-api.deploy.prod.yaml index 357c2ec152..6cdfc966a1 100644 --- a/.github/workflows/core-api.deploy.prod.yaml +++ b/.github/workflows/core-api.deploy.prod.yaml @@ -33,9 +33,8 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} - - name: Restart SchemaSpy pods - run: | - oc -n 4c2ba9-prod rollout restart deployment/schemaspy + - name: SchemaSpy Rollout + uses: ./.github/workflows/schemaspy-rollout-prod.yaml trigger-gitops: runs-on: ubuntu-20.04 @@ -61,8 +60,8 @@ jobs: run-if-failed: runs-on: ubuntu-20.04 - needs: [trigger-gitops] - if: always() && (needs.trigger-gitops.result == 'failure') + needs: [promote-image-to-prod, trigger-gitops] + if: ${{ always() && contains(needs.*.result, 'failure') }} steps: - name: Notification run: ./gitops/watch-deployment.sh core-api prod ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 diff --git a/.github/workflows/core-api.deploy.test.yaml b/.github/workflows/core-api.deploy.test.yaml index 8ce98ff118..e36e8cd76e 100644 --- a/.github/workflows/core-api.deploy.test.yaml +++ b/.github/workflows/core-api.deploy.test.yaml @@ -33,9 +33,8 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} - - name: Restart SchemaSpy pods - run: | - oc -n 4c2ba9-test rollout restart deployment/schemaspy + - name: SchemaSpy Rollout + uses: ./.github/workflows/schemaspy-rollout-test.yaml trigger-gitops: runs-on: ubuntu-20.04 @@ -64,8 +63,8 @@ jobs: run-if-failed: runs-on: ubuntu-20.04 - needs: [trigger-gitops] - if: always() && (needs.trigger-gitops.result == 'failure') + needs: [promote-image-to-test, trigger-gitops] + if: ${{ always() && contains(needs.*.result, 'failure') }} steps: - name: Notification run: ./gitops/watch-deployment.sh core-api test ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 diff --git a/.github/workflows/schemaspy-rollout-dev.yaml b/.github/workflows/schemaspy-rollout-dev.yaml index db285f81cf..cd3bb8b0c5 100644 --- a/.github/workflows/schemaspy-rollout-dev.yaml +++ b/.github/workflows/schemaspy-rollout-dev.yaml @@ -1,13 +1,8 @@ name: SchemaSpy - DEV restart rollout on: - pull_request: + workflow_call: workflow_dispatch: - push: - branches: - - develop - paths: - - migrations/sql jobs: dev-schemaspy-rollout: diff --git a/.github/workflows/schemaspy-rollout-prod.yaml b/.github/workflows/schemaspy-rollout-prod.yaml new file mode 100644 index 0000000000..17f531f4cb --- /dev/null +++ b/.github/workflows/schemaspy-rollout-prod.yaml @@ -0,0 +1,12 @@ +name: SchemaSpy - PROD restart rollout + +on: + workflow_call: + workflow_dispatch: + +jobs: + dev-schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout.yaml + with: + environment: prod + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/schemaspy-rollout-test.yaml b/.github/workflows/schemaspy-rollout-test.yaml new file mode 100644 index 0000000000..a37827f118 --- /dev/null +++ b/.github/workflows/schemaspy-rollout-test.yaml @@ -0,0 +1,12 @@ +name: SchemaSpy - TEST restart rollout + +on: + workflow_call: + workflow_dispatch: + +jobs: + dev-schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout.yaml + with: + environment: test + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/schemaspy-rollout.yaml b/.github/workflows/schemaspy-rollout.yaml index 763b3f1004..a0cc6d93ad 100644 --- a/.github/workflows/schemaspy-rollout.yaml +++ b/.github/workflows/schemaspy-rollout.yaml @@ -8,8 +8,8 @@ on: type: string jobs: - test-schemaspy-rollout: - name: test-schemaspy-rollout + schemaspy-rollout: + name: schemaspy-rollout runs-on: ubuntu-20.04 steps: - name: Install oc From f6a45d054baeb3422a1101fcfcbb790c6db6cd42 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:23:38 -0600 Subject: [PATCH 11/15] just testing if secrets: inherit is necessary --- .github/workflows/schemaspy-rollout-dev.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/schemaspy-rollout-dev.yaml b/.github/workflows/schemaspy-rollout-dev.yaml index cd3bb8b0c5..06626dc60b 100644 --- a/.github/workflows/schemaspy-rollout-dev.yaml +++ b/.github/workflows/schemaspy-rollout-dev.yaml @@ -3,10 +3,11 @@ name: SchemaSpy - DEV restart rollout on: workflow_call: workflow_dispatch: + pull_request: jobs: dev-schemaspy-rollout: uses: ./.github/workflows/schemaspy-rollout.yaml with: environment: dev - secrets: inherit \ No newline at end of file + # secrets: inherit \ No newline at end of file From 81d1c35aab9034af6fcf3737b7f74a6e49cde69a Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:29:06 -0600 Subject: [PATCH 12/15] just testing if secrets: inherit is necessary- but don't actually do a rollout this time --- .github/workflows/schemaspy-rollout.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schemaspy-rollout.yaml b/.github/workflows/schemaspy-rollout.yaml index a0cc6d93ad..ffd034be4b 100644 --- a/.github/workflows/schemaspy-rollout.yaml +++ b/.github/workflows/schemaspy-rollout.yaml @@ -25,18 +25,20 @@ jobs: uses: actions/checkout@v3 - name: Restart SchemaSpy pods + if: false run: | oc -n 4c2ba9-${{ inputs.environment }} rollout restart deployment/schemaspy - - name: Watch Rollout Status + - name: Watch Rollout Status + if: false run: | oc -n 4c2ba9-${{ inputs.environment }} rollout status deployment/schemaspy timeout-minutes: 10 - name: Notify Discord of Rollout success - if: ${{ success() }} + if: false run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 - name: Notify Discord of Rollout failure - if: ${{ failure() }} + if: false run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 From 17cdd525220e60956492cdc077161cc8fccf9c86 Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:37:46 -0600 Subject: [PATCH 13/15] secrets: inherit is absolutely necessary for workflow_call- change calls from steps to jobs so context can be added --- .github/workflows/core-api.build.deploy.dev.yaml | 6 ++++-- .github/workflows/core-api.deploy.prod.yaml | 5 +++-- .github/workflows/core-api.deploy.test.yaml | 5 +++-- .github/workflows/schemaspy-rollout-dev.yaml | 3 +-- .github/workflows/schemaspy-rollout.yaml | 6 ++---- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/core-api.build.deploy.dev.yaml b/.github/workflows/core-api.build.deploy.dev.yaml index 5489fb2275..3f7cafd71c 100644 --- a/.github/workflows/core-api.build.deploy.dev.yaml +++ b/.github/workflows/core-api.build.deploy.dev.yaml @@ -52,8 +52,10 @@ jobs: - name: Push run: | docker push --all-tags ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.MIG }} - - name: SchemaSpy Rollout - uses: ./.github/workflows/schemaspy-rollout-dev.yaml + + schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout-dev.yaml + secrets: inherit trigger-gitops: diff --git a/.github/workflows/core-api.deploy.prod.yaml b/.github/workflows/core-api.deploy.prod.yaml index 6cdfc966a1..8c446d8079 100644 --- a/.github/workflows/core-api.deploy.prod.yaml +++ b/.github/workflows/core-api.deploy.prod.yaml @@ -33,8 +33,9 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} - - name: SchemaSpy Rollout - uses: ./.github/workflows/schemaspy-rollout-prod.yaml + schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout-prod.yaml + secrets: inherit trigger-gitops: runs-on: ubuntu-20.04 diff --git a/.github/workflows/core-api.deploy.test.yaml b/.github/workflows/core-api.deploy.test.yaml index e36e8cd76e..54adf6edca 100644 --- a/.github/workflows/core-api.deploy.test.yaml +++ b/.github/workflows/core-api.deploy.test.yaml @@ -33,8 +33,9 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \ ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} - - name: SchemaSpy Rollout - uses: ./.github/workflows/schemaspy-rollout-test.yaml + schemaspy-rollout: + uses: ./.github/workflows/schemaspy-rollout-dev.yaml + secrets: inherit trigger-gitops: runs-on: ubuntu-20.04 diff --git a/.github/workflows/schemaspy-rollout-dev.yaml b/.github/workflows/schemaspy-rollout-dev.yaml index 06626dc60b..cd3bb8b0c5 100644 --- a/.github/workflows/schemaspy-rollout-dev.yaml +++ b/.github/workflows/schemaspy-rollout-dev.yaml @@ -3,11 +3,10 @@ name: SchemaSpy - DEV restart rollout on: workflow_call: workflow_dispatch: - pull_request: jobs: dev-schemaspy-rollout: uses: ./.github/workflows/schemaspy-rollout.yaml with: environment: dev - # secrets: inherit \ No newline at end of file + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/schemaspy-rollout.yaml b/.github/workflows/schemaspy-rollout.yaml index ffd034be4b..f015a9adad 100644 --- a/.github/workflows/schemaspy-rollout.yaml +++ b/.github/workflows/schemaspy-rollout.yaml @@ -25,20 +25,18 @@ jobs: uses: actions/checkout@v3 - name: Restart SchemaSpy pods - if: false run: | oc -n 4c2ba9-${{ inputs.environment }} rollout restart deployment/schemaspy - name: Watch Rollout Status - if: false run: | oc -n 4c2ba9-${{ inputs.environment }} rollout status deployment/schemaspy timeout-minutes: 10 - name: Notify Discord of Rollout success - if: false + if: ${{ success() }} run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0 - name: Notify Discord of Rollout failure - if: false + if: ${{ failure() }} run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1 From a00f40fd848120028db5ba2f679b3a973be202bc Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:38:49 -0600 Subject: [PATCH 14/15] rename workflow with proper name --- .github/workflows/schemaspy-rollout.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/schemaspy-rollout.yaml b/.github/workflows/schemaspy-rollout.yaml index f015a9adad..643d8fcc78 100644 --- a/.github/workflows/schemaspy-rollout.yaml +++ b/.github/workflows/schemaspy-rollout.yaml @@ -1,4 +1,4 @@ -name: Testing this as part of a workflow +name: SchemaSpy Rollout on: workflow_call: From a415d4481ec6045f861a40c48444498475495adf Mon Sep 17 00:00:00 2001 From: Tara Epp Date: Thu, 19 Oct 2023 14:45:40 -0600 Subject: [PATCH 15/15] only rollout schemaspy after build/deploy is successful --- .github/workflows/core-api.build.deploy.dev.yaml | 1 + .github/workflows/core-api.deploy.prod.yaml | 1 + .github/workflows/core-api.deploy.test.yaml | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/core-api.build.deploy.dev.yaml b/.github/workflows/core-api.build.deploy.dev.yaml index 3f7cafd71c..662b093af7 100644 --- a/.github/workflows/core-api.build.deploy.dev.yaml +++ b/.github/workflows/core-api.build.deploy.dev.yaml @@ -55,6 +55,7 @@ jobs: schemaspy-rollout: uses: ./.github/workflows/schemaspy-rollout-dev.yaml + needs: [build-flyway] secrets: inherit diff --git a/.github/workflows/core-api.deploy.prod.yaml b/.github/workflows/core-api.deploy.prod.yaml index 8c446d8079..2af7d9488e 100644 --- a/.github/workflows/core-api.deploy.prod.yaml +++ b/.github/workflows/core-api.deploy.prod.yaml @@ -35,6 +35,7 @@ jobs: schemaspy-rollout: uses: ./.github/workflows/schemaspy-rollout-prod.yaml + needs: [promote-image-to-prod] secrets: inherit trigger-gitops: diff --git a/.github/workflows/core-api.deploy.test.yaml b/.github/workflows/core-api.deploy.test.yaml index 54adf6edca..51db4da759 100644 --- a/.github/workflows/core-api.deploy.test.yaml +++ b/.github/workflows/core-api.deploy.test.yaml @@ -34,7 +34,8 @@ jobs: ${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }} schemaspy-rollout: - uses: ./.github/workflows/schemaspy-rollout-dev.yaml + uses: ./.github/workflows/schemaspy-rollout-test.yaml + needs: [promote-image-to-test] secrets: inherit trigger-gitops: