From 0d29582e199c58045edc33b14b04145cc288cbc4 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Wed, 14 Aug 2024 12:37:15 +0800 Subject: [PATCH] ci: clean up docker/k8s setup --- .../actions/deploy_to_kubernetes/action.yml | 42 --------------- .github/actions/publish_to_docker/action.yml | 53 ------------------- .github/workflows/release_production.yml | 4 +- .github/workflows/release_staging.yml | 19 +------ 4 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 .github/actions/deploy_to_kubernetes/action.yml delete mode 100644 .github/actions/publish_to_docker/action.yml diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml deleted file mode 100644 index 145ff53d1..000000000 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: k8s_deploy -description: Deploy to Kubernetes -inputs: - K8S_VERSION: - description: Kubernetes version - required: true - K8S_NAMESPACE: - description: Kubernetes namespace - required: false - default: 'deriv-com-api-staging' - CA_CRT: - description: Kubernetes CA certificate - required: true - KUBE_SERVER: - description: Kubernetes server - required: true - SERVICEACCOUNT_TOKEN: - description: Kubernetes service account token - required: true - DOCKERHUB_ORGANISATION: - description: Dockerhub organisation - required: true -runs: - using: composite - steps: - - name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} 🚀 - env: - K8S_VERSION: ${{ inputs.K8S_VERSION }} - NAMESPACE: ${{ inputs.K8S_NAMESPACE }} - KUBE_SERVER: ${{ inputs.KUBE_SERVER }} - SERVICEACCOUNT_TOKEN: ${{ inputs.SERVICEACCOUNT_TOKEN }} - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - CA_CRT: ${{ inputs.CA_CRT }} - APP_NAME: deriv-com-api - - run: | - git clone https://github.com/binary-com/devops-ci-scripts - cd devops-ci-scripts/k8s-build_tools - echo $CA_CRT | base64 --decode > ca.crt - export CA="ca.crt" - ./release.sh ${APP_NAME} $K8S_VERSION - shell: bash diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml deleted file mode 100644 index 3875c0c95..000000000 --- a/.github/actions/publish_to_docker/action.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: docker_build_push -description: Build and push Docker image to Docker Hub -inputs: - DOCKER_LATEST_IMAGE_TAG: - description: Docker image tag - required: false - default: 'latest-staging' - DOCKER_IMAGE_TAG: - description: Docker image tag - required: true - DOCKERHUB_ORGANISATION: - description: Docker Hub organisation - required: true - DOCKERHUB_USERNAME: - description: Docker Hub username - required: true - DOCKERHUB_PASSWORD: - description: Docker Hub password - required: true -runs: - using: composite - steps: - - name: Building docker image 🐳 - env: - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - DOCKER_IMAGE_TAG: ${{ inputs.DOCKER_IMAGE_TAG }} - DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} - run: | - docker build -t $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_IMAGE_TAG -t $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG . - shell: bash - - - name: Verify nginx image - env: - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} - run: | - set -e - docker run --rm $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG nginx -t - echo "docker image validated successfully" - shell: bash - - - name: Pushing Image to docker hub 🐳 - env: - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - DOCKER_IMAGE_TAG: ${{ inputs.DOCKER_IMAGE_TAG }} - DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} - DOCKERHUB_PASSWORD: ${{ inputs.DOCKERHUB_PASSWORD }} - DOCKERHUB_USERNAME: ${{ inputs.DOCKERHUB_USERNAME }} - run: | - echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin - docker push $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_IMAGE_TAG - docker push $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG - shell: bash diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index b18307062..5cf2eb166 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -69,8 +69,8 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} MESSAGE: ${{ steps.create_slack_message.outputs.MESSAGE }} - build_and_publish_to_docker_k8s: - name: Builds and Publishes image to Docker and Kubernetes + publish_to_vercel_DR: + name: Publish to Vercel DR runs-on: ubuntu-latest environment: Production needs: [build_and_publish] diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 8d7b90a6e..13630a5af 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -33,24 +33,7 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CF_BRANCH: staging PROJECT_NAME: deriv-developers-portal-pages - - name: Publish to Docker - uses: ./.github/actions/publish_to_docker - with: - DOCKER_LATEST_IMAGE_TAG: 'latest-staging' - DOCKER_IMAGE_TAG: ${{ github.ref_name }} - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy to Kubernetes - uses: ./.github/actions/deploy_to_kubernetes - with: - K8S_VERSION: ${{ github.ref_name }} - K8S_NAMESPACE: 'deriv-com-api-staging' - CA_CRT: ${{ secrets.CA_CRT }} - SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} - KUBE_SERVER: ${{ secrets.KUBE_SERVER }} - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} - - name: Upload to vercel + - name: Upload to vercel DR uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' with: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}