From 208dd0258daf60a7a00fa048b57b97a0b4eed189 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 15:17:55 +0800 Subject: [PATCH 01/15] chore: add docker and k8s setup --- .../actions/deploy_to_kubernetes/action.yml | 31 ++++++++++++++++ .github/actions/publish_to_docker/action.yml | 36 +++++++++++++++++++ .github/workflows/release_production.yml | 14 ++++++++ .github/workflows/release_staging.yml | 14 ++++++++ 4 files changed, 95 insertions(+) create mode 100644 .github/actions/deploy_to_kubernetes/action.yml create 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 new file mode 100644 index 000000000..2e09467ba --- /dev/null +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -0,0 +1,31 @@ +name: k8s_deploy +description: Deploy to Kubernetes +inputs: + TARGET: + description: Target environment + required: false + default: 'beta' + type: string + K8S_VERSION: + description: Kubernetes version + required: false + type: string + K8S_NAMESPACE: + description: Kubernetes namespace + required: false + type: string + default: 'deriv-com-api-staging' + CA_CRT: + description: Kubernetes CA certificate + required: false + type: string +steps: + - k8s/install-kubectl + - run: + name: Deploying to k8s cluster for service << ${{ inputs.K8S_NAMESPACE }} >> + command: | + export NAMESPACE=<< ${{ inputs.K8S_NAMESPACE }} >> + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo ${{ inputs.CA_CRT }} | base64 --decode > ca.crt + ./release.sh deriv-com-api << ${{ inputs.K8S_VERSION }} >> diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml new file mode 100644 index 000000000..d8f19b90a --- /dev/null +++ b/.github/actions/publish_to_docker/action.yml @@ -0,0 +1,36 @@ +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' + type: string + DOCKER_IMAGE_TAG: + description: Docker image tag + required: false + type: string + DOCKHUB_ORGANISATION: + description: Docker Hub organisation + required: true + type: string + DOCKERHUB_USERNAME: + description: Docker Hub username + required: true + type: string + DOCKERHUB_PASSWORD: + description: Docker Hub password + required: true + type: string + steps: + - setup_remote_docker + - run: + name: Building docker image + command: | + docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> . + - run: + name: Pushing Image to docker hub + command: | + echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin + docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> + docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> \ No newline at end of file diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index dabeaae71..919689531 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -28,6 +28,20 @@ jobs: - name: Extract version id: extract_version run: echo "RELEASE_VERSION=$(cat build/version)" >> $GITHUB_OUTPUT + - name: Publish to Docker + uses: ./.github/actions/publish_to_docker + with: + DOCKER_LATEST_IMAGE_TAG: 'latest' + DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }} + DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy to Kubernetes + uses: ./.github/actions/deploy_to_kubernetes + with: + K8S_VERSION: ${{ secrets.SHA1 }} + K8S_NAMESPACE: 'deriv-com-api-production' + CA_CRT: ${{ secrets.CA_CRT }} - name: Publish to Cloudflare Pages Production uses: ./.github/actions/publish_to_pages_production with: diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 249df8bd0..2edd3025a 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -21,6 +21,20 @@ jobs: uses: ./.github/actions/build with: NODE_ENV: staging + - name: Publish to Docker + uses: ./.github/actions/publish_to_docker + with: + DOCKER_LATEST_IMAGE_TAG: 'latest-staging' + DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }} + DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy to Kubernetes + uses: ./.github/actions/deploy_to_kubernetes + with: + K8S_VERSION: ${{ secrets.SHA1 }} + K8S_NAMESPACE: 'deriv-com-api-staging' + CA_CRT: ${{ secrets.CA_CRT }} - name: Publish to Cloudflare Pages Staging uses: ./.github/actions/publish_to_pages_staging with: From 1a5c9d298f89eabf3dbefe1f3d3c715c4374d809 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 15:52:47 +0800 Subject: [PATCH 02/15] chore: make input required --- .github/actions/deploy_to_kubernetes/action.yml | 2 +- .github/actions/publish_to_docker/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml index 2e09467ba..ebd3ebc6a 100644 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -8,7 +8,7 @@ inputs: type: string K8S_VERSION: description: Kubernetes version - required: false + required: true type: string K8S_NAMESPACE: description: Kubernetes namespace diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index d8f19b90a..a95b8ab0f 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -8,7 +8,7 @@ inputs: type: string DOCKER_IMAGE_TAG: description: Docker image tag - required: false + required: true type: string DOCKHUB_ORGANISATION: description: Docker Hub organisation From feddd979bf0a60031ce473907be67cd2bf9f4dbc Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 15:54:56 +0800 Subject: [PATCH 03/15] chore: make input required --- .github/actions/deploy_to_kubernetes/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml index ebd3ebc6a..c0ff4b8a7 100644 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -17,7 +17,7 @@ inputs: default: 'deriv-com-api-staging' CA_CRT: description: Kubernetes CA certificate - required: false + required: true type: string steps: - k8s/install-kubectl From 6de27b8e7b0ca460d78e4304be9ce9f1bfb12509 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 15:57:13 +0800 Subject: [PATCH 04/15] chore: resolve EOL --- .github/actions/publish_to_docker/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index a95b8ab0f..3f54422ce 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -33,4 +33,5 @@ inputs: command: | echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> - docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> \ No newline at end of file + docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> + \ No newline at end of file From 0f637a8e03c0b80c8a182c33a0eaf5a6db55b312 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 15:59:43 +0800 Subject: [PATCH 05/15] chore: resolve end of line --- .github/actions/publish_to_docker/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index 3f54422ce..5508189f9 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -34,4 +34,3 @@ inputs: echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> - \ No newline at end of file From 3e44f8dbbd8705222d9ce511394f00f25038f7b3 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 16:24:01 +0800 Subject: [PATCH 06/15] chore: remove circleci syntax --- .github/actions/deploy_to_kubernetes/action.yml | 6 +++--- .github/actions/publish_to_docker/action.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml index c0ff4b8a7..807e87527 100644 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -22,10 +22,10 @@ inputs: steps: - k8s/install-kubectl - run: - name: Deploying to k8s cluster for service << ${{ inputs.K8S_NAMESPACE }} >> + name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} command: | - export NAMESPACE=<< ${{ inputs.K8S_NAMESPACE }} >> + export NAMESPACE=${{ inputs.K8S_NAMESPACE }} git clone https://github.com/binary-com/devops-ci-scripts cd devops-ci-scripts/k8s-build_tools echo ${{ inputs.CA_CRT }} | base64 --decode > ca.crt - ./release.sh deriv-com-api << ${{ inputs.K8S_VERSION }} >> + ./release.sh deriv-com-api ${{ inputs.K8S_VERSION }} diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index 5508189f9..cc6bbb5f2 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -27,10 +27,10 @@ inputs: - run: name: Building docker image command: | - docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> . + docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }}. - run: name: Pushing Image to docker hub command: | echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin - docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> - docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> + docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} + docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} From 6d2f57575b0946a505e6195f1c11c16e4b462ff9 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 16:28:42 +0800 Subject: [PATCH 07/15] chore: add remove space --- .github/actions/publish_to_docker/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index cc6bbb5f2..4c1887270 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -27,7 +27,7 @@ inputs: - run: name: Building docker image command: | - docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }}. + docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} . - run: name: Pushing Image to docker hub command: | From f070f402213f1fff3ea50a8a3d288aae84e1ac10 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 16:33:57 +0800 Subject: [PATCH 08/15] chore: move cloudflare publish step before k8s and docker --- .github/workflows/release_production.yml | 10 +++++----- .github/workflows/release_staging.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index 919689531..9a658648f 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -28,6 +28,11 @@ jobs: - name: Extract version id: extract_version run: echo "RELEASE_VERSION=$(cat build/version)" >> $GITHUB_OUTPUT + - name: Publish to Cloudflare Pages Production + uses: ./.github/actions/publish_to_pages_production + with: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - name: Publish to Docker uses: ./.github/actions/publish_to_docker with: @@ -42,11 +47,6 @@ jobs: K8S_VERSION: ${{ secrets.SHA1 }} K8S_NAMESPACE: 'deriv-com-api-production' CA_CRT: ${{ secrets.CA_CRT }} - - name: Publish to Cloudflare Pages Production - uses: ./.github/actions/publish_to_pages_production - with: - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} send_slack_notification: name: Send Slack Notification environment: Production diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 2edd3025a..1417e8304 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -21,6 +21,11 @@ jobs: uses: ./.github/actions/build with: NODE_ENV: staging + - name: Publish to Cloudflare Pages Staging + uses: ./.github/actions/publish_to_pages_staging + with: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - name: Publish to Docker uses: ./.github/actions/publish_to_docker with: @@ -35,8 +40,3 @@ jobs: K8S_VERSION: ${{ secrets.SHA1 }} K8S_NAMESPACE: 'deriv-com-api-staging' CA_CRT: ${{ secrets.CA_CRT }} - - name: Publish to Cloudflare Pages Staging - uses: ./.github/actions/publish_to_pages_staging - with: - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} From ffe1b6470967263dc7f05367b3ce6d2424faf9d2 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Thu, 9 Nov 2023 17:14:44 +0800 Subject: [PATCH 09/15] chore: remove unused input var --- .github/actions/deploy_to_kubernetes/action.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml index 807e87527..df901bfb1 100644 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -1,11 +1,6 @@ name: k8s_deploy description: Deploy to Kubernetes inputs: - TARGET: - description: Target environment - required: false - default: 'beta' - type: string K8S_VERSION: description: Kubernetes version required: true From 4d7a81fead38c33663eaa42cc320f499abaaa7fb Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Mon, 20 Nov 2023 15:46:50 +0800 Subject: [PATCH 10/15] chore: update env name to match that of deriv-app --- .github/workflows/release_production.yml | 2 +- .github/workflows/release_staging.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index 9a658648f..3ea151499 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -38,7 +38,7 @@ jobs: with: DOCKER_LATEST_IMAGE_TAG: 'latest' DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }} - DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }} + DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy to Kubernetes diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 1417e8304..131656c1d 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -31,7 +31,7 @@ jobs: with: DOCKER_LATEST_IMAGE_TAG: 'latest-staging' DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }} - DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }} + DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy to Kubernetes From 079a85459702813d420b057dfcd244333c653ad5 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Mon, 20 Nov 2023 15:49:07 +0800 Subject: [PATCH 11/15] chore: update input name and add verify image step --- .github/actions/publish_to_docker/action.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index 4c1887270..c3f762728 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -10,7 +10,7 @@ inputs: description: Docker image tag required: true type: string - DOCKHUB_ORGANISATION: + DOCKERHUB_ORGANISATION: description: Docker Hub organisation required: true type: string @@ -25,12 +25,17 @@ inputs: steps: - setup_remote_docker - run: - name: Building docker image + name: Building docker image 🐳 command: | - docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} . + docker build -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} . + - name: Verify nginx image + run: | + set -e + docker run --rm ${DOCKERHUB_ORGANISATION}/deriv-com-api:${{ github.ref_name }} nginx -t + echo "docker image validated successfully" - run: - name: Pushing Image to docker hub + name: Pushing Image to docker hub 🐳 command: | echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin - docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} - docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} + docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} + docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} From 26207254a73b1505dbad0c99b7195fa25c0fb341 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Mon, 20 Nov 2023 16:09:46 +0800 Subject: [PATCH 12/15] chore: add CA export to the deployment step --- .github/actions/deploy_to_kubernetes/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy_to_kubernetes/action.yml b/.github/actions/deploy_to_kubernetes/action.yml index df901bfb1..8909ef70d 100644 --- a/.github/actions/deploy_to_kubernetes/action.yml +++ b/.github/actions/deploy_to_kubernetes/action.yml @@ -17,10 +17,11 @@ inputs: steps: - k8s/install-kubectl - run: - name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} + name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} 🚀 command: | export NAMESPACE=${{ inputs.K8S_NAMESPACE }} git clone https://github.com/binary-com/devops-ci-scripts cd devops-ci-scripts/k8s-build_tools echo ${{ inputs.CA_CRT }} | base64 --decode > ca.crt + export CA="ca.crt" ./release.sh deriv-com-api ${{ inputs.K8S_VERSION }} From 2eace295f5c18dcf9eeb504b6f56970c0c3647e7 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Mon, 20 Nov 2023 17:10:22 +0800 Subject: [PATCH 13/15] chore: update image verify step to use inputs --- .github/actions/publish_to_docker/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish_to_docker/action.yml b/.github/actions/publish_to_docker/action.yml index c3f762728..fc493fab8 100644 --- a/.github/actions/publish_to_docker/action.yml +++ b/.github/actions/publish_to_docker/action.yml @@ -31,7 +31,7 @@ inputs: - name: Verify nginx image run: | set -e - docker run --rm ${DOCKERHUB_ORGANISATION}/deriv-com-api:${{ github.ref_name }} nginx -t + docker run --rm ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} nginx -t echo "docker image validated successfully" - run: name: Pushing Image to docker hub 🐳 From 3b37e49546ca0fa2050968b1078ab2bb40cdf70b Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 20 Nov 2023 17:55:56 +0800 Subject: [PATCH 14/15] ci/ use ref_name instead of SHA1 --- .github/workflows/release_staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 131656c1d..ec409a708 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -37,6 +37,6 @@ jobs: - name: Deploy to Kubernetes uses: ./.github/actions/deploy_to_kubernetes with: - K8S_VERSION: ${{ secrets.SHA1 }} + K8S_VERSION: ${{ github.ref_name }} K8S_NAMESPACE: 'deriv-com-api-staging' CA_CRT: ${{ secrets.CA_CRT }} From 90be40db162f16136c212044ad388ae293622e56 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 20 Nov 2023 17:56:03 +0800 Subject: [PATCH 15/15] ci/ use ref_name instead of SHA1 --- .github/workflows/release_production.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_production.yml b/.github/workflows/release_production.yml index 3ea151499..1add3cfce 100644 --- a/.github/workflows/release_production.yml +++ b/.github/workflows/release_production.yml @@ -44,7 +44,7 @@ jobs: - name: Deploy to Kubernetes uses: ./.github/actions/deploy_to_kubernetes with: - K8S_VERSION: ${{ secrets.SHA1 }} + K8S_VERSION: ${{ github.ref_name }} K8S_NAMESPACE: 'deriv-com-api-production' CA_CRT: ${{ secrets.CA_CRT }} send_slack_notification: