Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS-5515] SchemaSpy updates #2718

Merged
merged 15 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically didn't put schemaspy-rollout in here because this notification will say that core-api didn't deploy, and schemaspy has its own notification anyway

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:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to be able to use workflow_call to have it be triggered from another workflow, and workflow_dispatch, so we can call it manually. Only needed separate files for each to allow manual calls.


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
Loading