CORE API - Promote PROD #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CORE API - Promote PROD | |
on: | |
workflow_dispatch: | |
env: | |
ORIG_TAG: test | |
PROMOTE_TAG: prod | |
jobs: | |
promote-image-to-prod: | |
name: promote-core-api-to-prod | |
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: Promote core-api from test to prod | |
run: | | |
oc -n ${{secrets.NS_TOOLS}} tag \ | |
${{ secrets.NS_TOOLS }}/backend:${{ env.ORIG_TAG }} \ | |
${{ secrets.NS_TOOLS }}/backend:${{ env.PROMOTE_TAG }} | |
- name: Promote flyway from test to prod | |
run: | | |
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-prod.yaml | |
needs: [promote-image-to-prod] | |
secrets: inherit | |
trigger-gitops: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 10 | |
needs: promote-image-to-prod | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Git Ops Push | |
run: ./gitops/commit.sh core-api test prod ${{ github.actor }} ${{ secrets.GH_TOKEN }} | |
- name: Install oc | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
oc: "4.7" | |
- name: Setup ArgoCD CLI | |
uses: imajeetyadav/argocd-cli@v1 | |
with: | |
version: v2.7.9 # optional | |
- name: oc login | |
run: oc login --token=${{ secrets.BUILD_TOKEN }} --server=${{ secrets.CLUSTER_API }} | |
- name: Notification | |
run: ./gitops/watch-deployment.sh core-api prod ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }} | |
run-if-failed: | |
runs-on: ubuntu-20.04 | |
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 |