Skip to content

[FIX] - Update to vcdm2.0, Add DI Proof and remove WIP code (#3276) #650

[FIX] - Update to vcdm2.0, Add DI Proof and remove WIP code (#3276)

[FIX] - Update to vcdm2.0, Add DI Proof and remove WIP code (#3276) #650

name: CORE API - Build & Deploy To DEV
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- migrations/**
- services/core-api/**
- .github/workflows/core-api.build.deploy.dev.yaml
env:
INITIAL_TAG: latest
TAG: dev
NAME: backend
MIG: flyway
CONTEXT: services/core-api/
MIG_CONTEXT: migrations/
jobs:
build-backend:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login
run: |
docker login -u ${{ secrets.CLUSTER_REGISTRY_USER }} -p ${{ secrets.BUILD_TOKEN }} ${{ secrets.CLUSTER_REGISTRY }}
- name: Build n Tag
run: |
docker build -t ${{ env.NAME }}:${{ env.INITIAL_TAG }} ${{ env.CONTEXT }} -f ${{ env.CONTEXT }}Dockerfile.ci
docker tag ${{ env.NAME }}:${{ env.INITIAL_TAG }} ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.NAME }}:${{ env.INITIAL_TAG }}
docker tag ${{ env.NAME }}:${{ env.INITIAL_TAG }} ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.NAME }}:${{ env.TAG }}
- name: Push
run: |
docker push --all-tags ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.NAME }}
build-flyway:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login
run: |
docker login -u ${{ secrets.CLUSTER_REGISTRY_USER }} -p ${{ secrets.BUILD_TOKEN }} ${{ secrets.CLUSTER_REGISTRY }}
- name: Build n Tag
run: |
docker build -t ${{ env.MIG }}:${{ env.INITIAL_TAG }} ${{ env.MIG_CONTEXT }} -f ${{ env.MIG_CONTEXT }}Dockerfile.flyway.ci
docker tag ${{ env.MIG }}:${{ env.INITIAL_TAG }} ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.MIG }}:${{ env.INITIAL_TAG }}
docker tag ${{ env.MIG }}:${{ env.INITIAL_TAG }} ${{ secrets.CLUSTER_REGISTRY }}/${{ secrets.NS_TOOLS }}/${{ env.MIG }}:${{ env.TAG }}
- name: Push
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
needs: [build-backend, build-flyway]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Git Ops Push
run: ./gitops/commit.sh core-api dev dev ${{ 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 dev ${{ github.sha }} ${{ secrets.DISCORD_DEPLOYMENT_WEBHOOK }} ${{ secrets.ARGOCD_SERVER }} ${{ secrets.ARGO_CD_CLI_JWT }}
run-if-failed:
runs-on: ubuntu-20.04
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