diff --git a/.github/workflows/core-api.build.deploy.dev.yaml b/.github/workflows/core-api.build.deploy.dev.yaml index ee6e489b66..662b093af7 100644 --- a/.github/workflows/core-api.build.deploy.dev.yaml +++ b/.github/workflows/core-api.build.deploy.dev.yaml @@ -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 @@ -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 diff --git a/.github/workflows/core-api.deploy.prod.yaml b/.github/workflows/core-api.deploy.prod.yaml index d045471fe9..2af7d9488e 100644 --- a/.github/workflows/core-api.deploy.prod.yaml +++ b/.github/workflows/core-api.deploy.prod.yaml @@ -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 @@ -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 diff --git a/.github/workflows/core-api.deploy.test.yaml b/.github/workflows/core-api.deploy.test.yaml index 3d023747ff..51db4da759 100644 --- a/.github/workflows/core-api.deploy.test.yaml +++ b/.github/workflows/core-api.deploy.test.yaml @@ -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 @@ -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 diff --git a/.github/workflows/schemaspy-rollout-dev.yaml b/.github/workflows/schemaspy-rollout-dev.yaml new file mode 100644 index 0000000000..cd3bb8b0c5 --- /dev/null +++ b/.github/workflows/schemaspy-rollout-dev.yaml @@ -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 \ No newline at end of file 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 new file mode 100644 index 0000000000..643d8fcc78 --- /dev/null +++ b/.github/workflows/schemaspy-rollout.yaml @@ -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