From 0242707e33e2c1e7846d5c86350940f5e0b73ebe Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 11:49:38 -0800 Subject: [PATCH 01/12] gh action test kubectl --- .github/workflows/deploy-gamma.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index 290f1f892..f9167c296 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -23,4 +23,6 @@ jobs: run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 k8s-1-25-4-do-0-nyc1-1670645170179 - name: switch to gamma namespace run: kubectl config set-context --current --namespace=gamma + - name: test kubectl + run: kubectl get ingress \ No newline at end of file From dc6d036d86c865fe7b82cb1ec4f1e78663bd3a97 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:08:47 -0800 Subject: [PATCH 02/12] write helm values to file form secret --- .github/workflows/deploy-gamma.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index f9167c296..2b6258109 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -13,6 +13,10 @@ jobs: uses: azure/setup-helm@v3 with: version: v3.10.0 + - name: Install infisical helm chart + run: | + helm repo add infisical-helm-charts 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' + helm repo update - name: Install kubectl uses: azure/setup-kubectl@v3 - name: Install doctl @@ -25,4 +29,10 @@ jobs: run: kubectl config set-context --current --namespace=gamma - name: test kubectl run: kubectl get ingress + - name: Write helm values to file + run: | + echo "${{ secrets.HELM_VALUES_GAMMA }}" > values.yaml + cat values.yml + + \ No newline at end of file From d1f296b7e791a5558c10e78a5d80e20a3714bed6 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:11:05 -0800 Subject: [PATCH 03/12] fix indent gamma deploy gha --- .github/workflows/deploy-gamma.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index 2b6258109..f914ca8aa 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -15,8 +15,8 @@ jobs: version: v3.10.0 - name: Install infisical helm chart run: | - helm repo add infisical-helm-charts 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' - helm repo update + helm repo add infisical-helm-charts 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' + helm repo update - name: Install kubectl uses: azure/setup-kubectl@v3 - name: Install doctl @@ -31,8 +31,8 @@ jobs: run: kubectl get ingress - name: Write helm values to file run: | - echo "${{ secrets.HELM_VALUES_GAMMA }}" > values.yaml - cat values.yml + echo "${{ secrets.HELM_VALUES_GAMMA }}" > values.yaml + cat values.yml \ No newline at end of file From eb9a8e0285d897c3250eae96a98e0b3e731a3e4f Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:16:36 -0800 Subject: [PATCH 04/12] echo values file --- .github/workflows/deploy-gamma.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index f914ca8aa..6fb01abc5 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -31,8 +31,7 @@ jobs: run: kubectl get ingress - name: Write helm values to file run: | - echo "${{ secrets.HELM_VALUES_GAMMA }}" > values.yaml - cat values.yml + echo "${{ secrets.HELM_VALUES_GAMMA }}" \ No newline at end of file From 593765cb248656e3b3b6929c4932cfd29c8e2585 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:31:55 -0800 Subject: [PATCH 05/12] cat values file after downloading --- .github/workflows/deploy-gamma.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index 6fb01abc5..d46142707 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -31,7 +31,8 @@ jobs: run: kubectl get ingress - name: Write helm values to file run: | - echo "${{ secrets.HELM_VALUES_GAMMA }}" + wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml + cat values.yaml \ No newline at end of file From 323701d432fcaf5a21f04fcbffe2c705077138c6 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:38:56 -0800 Subject: [PATCH 06/12] add gha upgrade helmchart --- .github/workflows/deploy-gamma.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml index d46142707..b72f87a61 100644 --- a/.github/workflows/deploy-gamma.yml +++ b/.github/workflows/deploy-gamma.yml @@ -29,10 +29,11 @@ jobs: run: kubectl config set-context --current --namespace=gamma - name: test kubectl run: kubectl get ingress - - name: Write helm values to file + - name: Download helm values to file and upgrade gamma deploy run: | wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml - cat values.yaml + helm upgrade infisical infisical-helm-charts/infisical --values values.yaml --recreate-pods + \ No newline at end of file From 17bae52830f587752c59d28e57c1ceaeba5f7ff0 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:52:07 -0800 Subject: [PATCH 07/12] gamma deployment after image build --- .github/workflows/docker-image.yml | 34 +++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ab7b939e7..34847749b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -99,4 +99,36 @@ jobs: infisical/frontend:latest platforms: linux/amd64,linux/arm64 build-args: | - POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} \ No newline at end of file + POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} + gamma-deployment: + name: Deploy to gamma + runs-on: ubuntu-latest + needs: frontend-image backend-image + if: github.event_name == 'repository_dispatch' + steps: + - name: ☁️ Checkout source + uses: actions/checkout@v3 + - name: Install Helm + uses: azure/setup-helm@v3 + with: + version: v3.10.0 + - name: Install infisical helm chart + run: | + helm repo add infisical-helm-charts 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' + helm repo update + - name: Install kubectl + uses: azure/setup-kubectl@v3 + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + - name: Save DigitalOcean kubeconfig with short-lived credentials + run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 k8s-1-25-4-do-0-nyc1-1670645170179 + - name: switch to gamma namespace + run: kubectl config set-context --current --namespace=gamma + - name: test kubectl + run: kubectl get ingress + - name: Download helm values to file and upgrade gamma deploy + run: | + wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml + helm upgrade infisical infisical-helm-charts/infisical --values values.yaml --recreate-pods \ No newline at end of file From 189d24589e90ef5271b269b4765dd39f50b5d748 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 12:53:53 -0800 Subject: [PATCH 08/12] correct needs fields in gha --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 34847749b..30e938a54 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -103,7 +103,7 @@ jobs: gamma-deployment: name: Deploy to gamma runs-on: ubuntu-latest - needs: frontend-image backend-image + needs: [frontend-image, backend-image] if: github.event_name == 'repository_dispatch' steps: - name: ☁️ Checkout source From a00e6df59ff3db951a2f69835d158bd26ce679dc Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 13:09:57 -0800 Subject: [PATCH 09/12] add manual approval setp --- .github/workflows/docker-image.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 30e938a54..9d8a6b0a8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -100,10 +100,19 @@ jobs: platforms: linux/amd64,linux/arm64 build-args: | POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} + manualApprove: + needs: [frontend-image, backend-image] + environment: + name: gamma-deployment + runs-on: ubuntu-latest + steps: + - name: manual approve + run: | + echo "Manually approved" gamma-deployment: name: Deploy to gamma runs-on: ubuntu-latest - needs: [frontend-image, backend-image] + needs: [manualApprove] if: github.event_name == 'repository_dispatch' steps: - name: ☁️ Checkout source From 092e4a55bdb0cdf8f94fd757cd4d0c4c0eff84ee Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 13:13:15 -0800 Subject: [PATCH 10/12] enable auto deploy to gamma --- .github/workflows/docker-image.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 9d8a6b0a8..142245dc8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -100,20 +100,10 @@ jobs: platforms: linux/amd64,linux/arm64 build-args: | POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} - manualApprove: - needs: [frontend-image, backend-image] - environment: - name: gamma-deployment - runs-on: ubuntu-latest - steps: - - name: manual approve - run: | - echo "Manually approved" gamma-deployment: name: Deploy to gamma runs-on: ubuntu-latest - needs: [manualApprove] - if: github.event_name == 'repository_dispatch' + needs: [frontend-image, backend-image] steps: - name: ☁️ Checkout source uses: actions/checkout@v3 From 64d1f252e29f1f415e90f5f73f0b62a811e32e33 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 13:39:30 -0800 Subject: [PATCH 11/12] Rename workflow file --- .github/workflows/docker-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 142245dc8..ffc6e5c40 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,5 +1,4 @@ -name: Push frontend and backend to Dockerhub - +name: Build, Publish and Deploy to Gamma on: [workflow_dispatch] jobs: From 87a3f9a03c03bdeb6a8ed94500c75f97f97789ea Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Fri, 13 Jan 2023 13:41:56 -0800 Subject: [PATCH 12/12] delete gamma deploy workflow file --- .github/workflows/deploy-gamma.yml | 39 ------------------------------ 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/deploy-gamma.yml diff --git a/.github/workflows/deploy-gamma.yml b/.github/workflows/deploy-gamma.yml deleted file mode 100644 index b72f87a61..000000000 --- a/.github/workflows/deploy-gamma.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy to Gamma stage - -on: [workflow_dispatch] - -jobs: - deployment: - name: Deploy to gamma - runs-on: ubuntu-latest - steps: - - name: ☁️ Checkout source - uses: actions/checkout@v3 - - name: Install Helm - uses: azure/setup-helm@v3 - with: - version: v3.10.0 - - name: Install infisical helm chart - run: | - helm repo add infisical-helm-charts 'https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/' - helm repo update - - name: Install kubectl - uses: azure/setup-kubectl@v3 - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - name: Save DigitalOcean kubeconfig with short-lived credentials - run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 k8s-1-25-4-do-0-nyc1-1670645170179 - - name: switch to gamma namespace - run: kubectl config set-context --current --namespace=gamma - - name: test kubectl - run: kubectl get ingress - - name: Download helm values to file and upgrade gamma deploy - run: | - wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml - helm upgrade infisical infisical-helm-charts/infisical --values values.yaml --recreate-pods - - - - \ No newline at end of file