Skip to content

Commit

Permalink
[MDS-5515] SchemaSpy updates (#2718)
Browse files Browse the repository at this point in the history
* a test file to run on PR to find any obvious issues, and then a rollout to test and prod on workflow dispatch

* testing reuse of watch-deployment

* hey why can't you find my file

* give it the repo so it can use script files

* get rid of unnecessary test parts, add in argocd

* testing to see if rollout status holds up discord notification

* add failure notification on timeout

* syntax error

* test reusable workflow

* some environment-specific workflows that call the reusable one, call it from core-api deploy workflows, and try to fix run-if-failed

* just testing if secrets: inherit is necessary

* just testing if secrets: inherit is necessary- but don't actually do a rollout this time

* secrets: inherit is absolutely necessary for workflow_call- change calls from steps to jobs so context can be added

* rename workflow with proper name

* only rollout schemaspy after build/deploy is successful
  • Loading branch information
taraepp authored Oct 20, 2023
1 parent 64c1443 commit a2f5af5
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 6 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/core-api.build.deploy.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
run: |
docker push --all-tags ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.MIG }}
schemaspy-rollout:
uses: ./.github/workflows/schemaspy-rollout-dev.yaml
needs: [build-flyway]
secrets: inherit


trigger-gitops:
runs-on: ubuntu-20.04
timeout-minutes: 15
Expand All @@ -77,8 +83,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
9 changes: 7 additions & 2 deletions .github/workflows/core-api.deploy.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \
${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }}
schemaspy-rollout:
uses: ./.github/workflows/schemaspy-rollout-prod.yaml
needs: [promote-image-to-prod]
secrets: inherit

trigger-gitops:
runs-on: ubuntu-20.04
timeout-minutes: 10
Expand All @@ -57,8 +62,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
9 changes: 7 additions & 2 deletions .github/workflows/core-api.deploy.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
oc -n ${{secrets.NS_TOOLS}} tag \
${{ secrets.NS_TOOLS }}/flyway:${{ env.ORIG_TAG }} \
${{ secrets.NS_TOOLS }}/flyway:${{ env.PROMOTE_TAG }}
schemaspy-rollout:
uses: ./.github/workflows/schemaspy-rollout-test.yaml
needs: [promote-image-to-test]
secrets: inherit

trigger-gitops:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -60,8 +65,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
12 changes: 12 additions & 0 deletions .github/workflows/schemaspy-rollout-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: SchemaSpy - DEV restart rollout

on:
workflow_call:
workflow_dispatch:

jobs:
dev-schemaspy-rollout:
uses: ./.github/workflows/schemaspy-rollout.yaml
with:
environment: dev
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/schemaspy-rollout-prod.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .github/workflows/schemaspy-rollout-test.yaml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions .github/workflows/schemaspy-rollout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: SchemaSpy Rollout

on:
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
schemaspy-rollout:
name: 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: Checkout
uses: actions/checkout@v3

- name: Restart SchemaSpy pods
run: |
oc -n 4c2ba9-${{ inputs.environment }} rollout restart deployment/schemaspy
- name: Watch Rollout Status
run: |
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 ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 0

- name: Notify Discord of Rollout failure
if: ${{ failure() }}
run: ./gitops/notify_discord.sh schemaspy ${{ inputs.environment }} ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} 1

0 comments on commit a2f5af5

Please sign in to comment.