From 559d296074c7117a08bc18a9fc513a2988573235 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 11:16:58 +0300 Subject: [PATCH 01/48] set image pull policy to always --- .github/workflows/pr-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index ee4d274341e3f..edb935263d10b 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -179,6 +179,7 @@ jobs: --namespace "pr${{ env.PR_NUMBER }}" \ --set coder.image.repo=${{ env.REPO }} \ --set coder.image.tag=pr${{ env.PR_NUMBER }} \ + --set coder.image.pullPolicy=Always \ --set coder.service.type=ClusterIP \ --set coder.serviceAccount.enableDeployments=true \ --set coder.env[0].name=CODER_ACCESS_URL \ From 6a7b662f2ed755b08153255d00a11f4ec682dd94 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 11:19:21 +0300 Subject: [PATCH 02/48] use PR branch to always use the branch helm chart --- .github/workflows/pr-deploy.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index edb935263d10b..fd013a036f7cf 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -126,9 +126,13 @@ jobs: PR_NUMBER: ${{ needs.pr_commented.outputs.PR_NUMBER }} PR_TITLE: ${{ needs.pr_commented.outputs.PR_TITLE }} PR_URL: ${{ needs.pr_commented.outputs.PR_URL }} + PR_BRANCH: ${{ needs.pr_commented.outputs.PR_BRANCH }} steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ env.PR_BRANCH }} + fetch-depth: 0 - name: Set up kubeconfig run: | From af3f46d0f60974271876f8bb7e533e8aac024ff6 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 11:20:32 +0300 Subject: [PATCH 03/48] commnet of the last comment --- .github/workflows/pr-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index fd013a036f7cf..47c9d9299df9b 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -231,6 +231,7 @@ jobs: issue-number: ${{ env.PR_NUMBER }} comment-author: "github-actions[bot]" body-includes: This deployment will be deleted when the PR is closed + direction: last - name: Comment on PR uses: peter-evans/create-or-update-comment@v3 From 7fcee184ca3998653f0d91cf1e81f824833f91d3 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 11:23:29 +0300 Subject: [PATCH 04/48] commnet the link to slack channel and not the deployment URL We will revert it back once we have GitHub OAuth setup. Probably after #8714 --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 47c9d9299df9b..1e95611dc412f 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -241,7 +241,7 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} body: | :heavy_check_mark: Deployed PR ${{ env.PR_NUMBER }} successfully. - :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }}). + :rocket: Access the deployment link [here](https://codercom.slack.com/archives/C05DNE982E8). :warning: This deployment will be deleted when the PR is closed. reactions: rocket From 5f5686e552f296725a2c086bfda85119688cdbba Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 11:25:20 +0300 Subject: [PATCH 05/48] remove `serviceAccount.enableDeployments=true` as this is the defaults now. Behavior is now default after #8704 --- .github/workflows/pr-deploy.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 1e95611dc412f..250b5e6a1f0f4 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -185,7 +185,6 @@ jobs: --set coder.image.tag=pr${{ env.PR_NUMBER }} \ --set coder.image.pullPolicy=Always \ --set coder.service.type=ClusterIP \ - --set coder.serviceAccount.enableDeployments=true \ --set coder.env[0].name=CODER_ACCESS_URL \ --set coder.env[0].value="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \ --set coder.env[1].name=CODER_WILDCARD_ACCESS_URL \ From 29162dd2ac9b9d871f9fe92b808856baa42921f8 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 12:48:02 +0300 Subject: [PATCH 06/48] enable GitHub OAuth --- .github/workflows/pr-deploy.yaml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 250b5e6a1f0f4..bdd7e4e2a1a26 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -191,18 +191,17 @@ jobs: --set coder.env[1].value="*--pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \ --set coder.env[2].name=CODER_EXPERIMENTS \ --set coder.env[2].value="*" \ + --set coder.env[3].name=CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS \ + --set coder.env[3].value=true \ + --set coder.env[4].name=CODER_OAUTH2_GITHUB_CLIENT_ID \ + --set coder.env[4].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }} \ + --set coder.env[5].name=CODER_OAUTH2_GITHUB_CLIENT_SECRET \ + --set coder.env[5].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }} \ + --set coder.env[6].name=CODER_OAUTH2_GITHUB_ALLOWED_ORGS \ + --set coder.env[6].value=coder \ + --set coder.env[7].name=CODER_OAUTH2_GITHUB_REDIRECT_URI \ + --set coder.env[7].value="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}/gitauth/github/callback \ --force - # Uncomment this when https://github.com/coder/coder/issues/8714 is resolved - # --set coder.env[3].name=CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS \ - # --set coder.env[3].value=true \ - # --set coder.env[4].name=CODER_OAUTH2_GITHUB_CLIENT_ID \ - # --set coder.env[4].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }} \ - # --set coder.env[5].name=CODER_OAUTH2_GITHUB_CLIENT_SECRET \ - # --set coder.env[5].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }} \ - # --set coder.env[6].name=CODER_OAUTH2_GITHUB_ALLOWED_ORGS \ - # --set coder.env[6].value=coder \ - # --set coder.env[7].name=CODER_OAUTH2_GITHUB_REDIRECT_URI \ - # --set coder.env[7].value="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}/gitauth/github/callback - name: Install coder-logstream-kube run: | From 1dadd50df79daa2f26a3c2a35c61ff36196a3af0 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 12:53:05 +0300 Subject: [PATCH 07/48] remove extra flag --- .github/workflows/pr-deploy.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index bdd7e4e2a1a26..b2e53a3ce98b3 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -199,8 +199,6 @@ jobs: --set coder.env[5].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }} \ --set coder.env[6].name=CODER_OAUTH2_GITHUB_ALLOWED_ORGS \ --set coder.env[6].value=coder \ - --set coder.env[7].name=CODER_OAUTH2_GITHUB_REDIRECT_URI \ - --set coder.env[7].value="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}/gitauth/github/callback \ --force - name: Install coder-logstream-kube From 59d99dc732a64ccb36b492d0138f133af3a4b67d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 13:49:48 +0300 Subject: [PATCH 08/48] comment deployment URL --- .github/workflows/pr-deploy.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index b2e53a3ce98b3..7927ef8c7ebe8 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -237,9 +237,12 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} body: | :heavy_check_mark: Deployed PR ${{ env.PR_NUMBER }} successfully. - :rocket: Access the deployment link [here](https://codercom.slack.com/archives/C05DNE982E8). + :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }} :warning: This deployment will be deleted when the PR is closed. reactions: rocket + env: + PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" + env: PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" From a9aa219f5b433b23d8e0e46d6449161d000fb4e7 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 13:50:36 +0300 Subject: [PATCH 09/48] Update pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 7927ef8c7ebe8..14bc7d8134547 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -237,7 +237,7 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} body: | :heavy_check_mark: Deployed PR ${{ env.PR_NUMBER }} successfully. - :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }} + :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }}). :warning: This deployment will be deleted when the PR is closed. reactions: rocket env: From d5f289f52aca5453dc7b40d925634c650b107e2f Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 16:40:27 +0300 Subject: [PATCH 10/48] fix fomratting --- .github/workflows/pr-deploy.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 14bc7d8134547..83bbcb0c42fa4 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -240,9 +240,5 @@ jobs: :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }}). :warning: This deployment will be deleted when the PR is closed. reactions: rocket - env: - PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - - env: PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" From dd898c1a0456927bc66bd812c2bbaeb657040aa3 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 16:56:18 +0300 Subject: [PATCH 11/48] quote env values --- .github/workflows/pr-deploy.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 83bbcb0c42fa4..6eb93a7fd8876 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -192,13 +192,13 @@ jobs: --set coder.env[2].name=CODER_EXPERIMENTS \ --set coder.env[2].value="*" \ --set coder.env[3].name=CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS \ - --set coder.env[3].value=true \ + --set coder.env[3].value="true" \ --set coder.env[4].name=CODER_OAUTH2_GITHUB_CLIENT_ID \ - --set coder.env[4].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }} \ + --set coder.env[4].value="${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" \ --set coder.env[5].name=CODER_OAUTH2_GITHUB_CLIENT_SECRET \ - --set coder.env[5].value=${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }} \ + --set coder.env[5].value="${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" \ --set coder.env[6].name=CODER_OAUTH2_GITHUB_ALLOWED_ORGS \ - --set coder.env[6].value=coder \ + --set coder.env[6].value="coder" \ --force - name: Install coder-logstream-kube From b022f7b366b06f0dca030371e9a26e81166a9ac6 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 17:11:54 +0300 Subject: [PATCH 12/48] make `CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS` a boolean --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 6eb93a7fd8876..8ebaf73d9e730 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -192,7 +192,7 @@ jobs: --set coder.env[2].name=CODER_EXPERIMENTS \ --set coder.env[2].value="*" \ --set coder.env[3].name=CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS \ - --set coder.env[3].value="true" \ + --set coder.env[3].value=true \ --set coder.env[4].name=CODER_OAUTH2_GITHUB_CLIENT_ID \ --set coder.env[4].value="${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" \ --set coder.env[5].name=CODER_OAUTH2_GITHUB_CLIENT_SECRET \ From 4d52b1bccbbfcd222ef24d9fae5e1b873579eb27 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 17:19:49 +0300 Subject: [PATCH 13/48] just for testing --- .github/workflows/pr-deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 8ebaf73d9e730..ac74eb0493329 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -72,6 +72,7 @@ jobs: build: needs: pr_commented + if: false # TODO remove before merging runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" @@ -119,7 +120,7 @@ jobs: deploy: needs: [build, pr_commented] - if: needs.build.result == 'success' + if: needs.build.result == 'success' || needs.build.result == 'skipped' # TODO remove before merging runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 0f3723e508aab3ef598867178933fdea7afe2e67 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:17:36 +0300 Subject: [PATCH 14/48] use values.yaml --- .github/workflows/pr-deploy.yaml | 48 +++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index ac74eb0493329..583c03f7d301c 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -178,28 +178,38 @@ jobs: EOF kubectl apply -f ingress.yaml + - name: Create values.yaml + run: | + cat < values.yaml + coder: + image: + repo: ${{ env.REPO }} + tag: pr${{ env.PR_NUMBER }} + pullPolicy: Always + service: + type: ClusterIP + env: + - name: CODER_ACCESS_URL + value: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" + - name: CODER_WILDCARD_ACCESS_URL + value: "*--pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" + - name: CODER_EXPERIMENTS + value: "*" + - name: CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS + value: true + - name: CODER_OAUTH2_GITHUB_CLIENT_ID + value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" + - name: CODER_OAUTH2_GITHUB_CLIENT_SECRET + value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" + - name: CODER_OAUTH2_GITHUB_ALLOWED_ORGS + value: "coder" + EOF + - name: Install Helm chart run: | - helm upgrade --install pr${{ env.PR_NUMBER }} ./helm \ + helm upgrade --install pr${{ env.PR_NUMBER }} ./helm \ --namespace "pr${{ env.PR_NUMBER }}" \ - --set coder.image.repo=${{ env.REPO }} \ - --set coder.image.tag=pr${{ env.PR_NUMBER }} \ - --set coder.image.pullPolicy=Always \ - --set coder.service.type=ClusterIP \ - --set coder.env[0].name=CODER_ACCESS_URL \ - --set coder.env[0].value="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \ - --set coder.env[1].name=CODER_WILDCARD_ACCESS_URL \ - --set coder.env[1].value="*--pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \ - --set coder.env[2].name=CODER_EXPERIMENTS \ - --set coder.env[2].value="*" \ - --set coder.env[3].name=CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS \ - --set coder.env[3].value=true \ - --set coder.env[4].name=CODER_OAUTH2_GITHUB_CLIENT_ID \ - --set coder.env[4].value="${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" \ - --set coder.env[5].name=CODER_OAUTH2_GITHUB_CLIENT_SECRET \ - --set coder.env[5].value="${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" \ - --set coder.env[6].name=CODER_OAUTH2_GITHUB_ALLOWED_ORGS \ - --set coder.env[6].value="coder" \ + -f values.yaml \ --force - name: Install coder-logstream-kube From afa229dad998eed1bec6487ef4fe436a316b6453 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:20:58 +0300 Subject: [PATCH 15/48] test --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 583c03f7d301c..d59650eda87d6 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -120,7 +120,7 @@ jobs: deploy: needs: [build, pr_commented] - if: needs.build.result == 'success' || needs.build.result == 'skipped' # TODO remove before merging + if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped') # TODO remove before merging runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 905a361242563799817e6d78a953ac7bfe03724b Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:22:51 +0300 Subject: [PATCH 16/48] only fetch last commit --- .github/workflows/pr-deploy.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index d59650eda87d6..c974375af300b 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -133,7 +133,6 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ env.PR_BRANCH }} - fetch-depth: 0 - name: Set up kubeconfig run: | From 2ee3ca0ed1b4078d0be58bd507bc724334e4f1f0 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:25:05 +0300 Subject: [PATCH 17/48] quotes --- .github/workflows/pr-deploy.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index c974375af300b..def3a5ac6b40f 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -188,19 +188,19 @@ jobs: service: type: ClusterIP env: - - name: CODER_ACCESS_URL + - name: "CODER_ACCESS_URL" value: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - - name: CODER_WILDCARD_ACCESS_URL + - name: "CODER_WILDCARD_ACCESS_URL" value: "*--pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - - name: CODER_EXPERIMENTS + - name: "CODER_EXPERIMENTS" value: "*" - - name: CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS + - name: "CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS value: true - - name: CODER_OAUTH2_GITHUB_CLIENT_ID + - name: "CODER_OAUTH2_GITHUB_CLIENT_ID" value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" - - name: CODER_OAUTH2_GITHUB_CLIENT_SECRET + - name: "CODER_OAUTH2_GITHUB_CLIENT_SECRET" value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" - - name: CODER_OAUTH2_GITHUB_ALLOWED_ORGS + - name: "CODER_OAUTH2_GITHUB_ALLOWED_ORGS" value: "coder" EOF From 69ea26c202582f678d31d9072e5be0643064b8bc Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:26:23 +0300 Subject: [PATCH 18/48] Update pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index def3a5ac6b40f..a530083ca7aa0 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -194,7 +194,7 @@ jobs: value: "*--pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - name: "CODER_EXPERIMENTS" value: "*" - - name: "CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS + - name: "CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS" value: true - name: "CODER_OAUTH2_GITHUB_CLIENT_ID" value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" From 8e2955b47cc5eb8e49e826c6f5fe02c0221b96d0 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:44:19 +0300 Subject: [PATCH 19/48] Update pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index a530083ca7aa0..3736d2a734716 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -179,7 +179,7 @@ jobs: - name: Create values.yaml run: | - cat < values.yaml + cat < pr-deploy-values.yaml coder: image: repo: ${{ env.REPO }} @@ -206,9 +206,9 @@ jobs: - name: Install Helm chart run: | - helm upgrade --install pr${{ env.PR_NUMBER }} ./helm \ + helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \ --namespace "pr${{ env.PR_NUMBER }}" \ - -f values.yaml \ + --values ./pr-deploy-values.yaml \ --force - name: Install coder-logstream-kube From 3bbeb7f9b2933f74e49c428902e9ce0af0900087 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:48:50 +0300 Subject: [PATCH 20/48] Update pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 3736d2a734716..4ffa322ef9ebd 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -195,7 +195,7 @@ jobs: - name: "CODER_EXPERIMENTS" value: "*" - name: "CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS" - value: true + value: "true" - name: "CODER_OAUTH2_GITHUB_CLIENT_ID" value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}" - name: "CODER_OAUTH2_GITHUB_CLIENT_SECRET" From 8960fda641d45a6222f1921169103ef2ace323a2 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:53:11 +0300 Subject: [PATCH 21/48] only comment if triggred by issue_comment --- .github/workflows/pr-deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 4ffa322ef9ebd..60d3dac19c279 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -62,6 +62,7 @@ jobs: - name: Comment on PR id: comment_id + if: github.event_name == "issue_comment" uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ steps.pr_info.outputs.PR_NUMBER }} @@ -232,6 +233,7 @@ jobs: - name: Find Comment uses: peter-evans/find-comment@v2 + if: github.event_name == "issue_comment" id: fc with: issue-number: ${{ env.PR_NUMBER }} @@ -241,6 +243,7 @@ jobs: - name: Comment on PR uses: peter-evans/create-or-update-comment@v3 + if: github.event_name == "issue_comment" with: issue-number: ${{ env.PR_NUMBER }} edit-mode: replace From d5a21aa905ca72ed2bafe26f332f255a2669569e Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:54:36 +0300 Subject: [PATCH 22/48] fix --- .github/workflows/pr-deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 60d3dac19c279..20bf031f29c02 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -62,7 +62,7 @@ jobs: - name: Comment on PR id: comment_id - if: github.event_name == "issue_comment" + if: github.event_name == 'issue_comment' uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ steps.pr_info.outputs.PR_NUMBER }} @@ -233,7 +233,7 @@ jobs: - name: Find Comment uses: peter-evans/find-comment@v2 - if: github.event_name == "issue_comment" + if: github.event_name == 'issue_comment' id: fc with: issue-number: ${{ env.PR_NUMBER }} @@ -243,7 +243,7 @@ jobs: - name: Comment on PR uses: peter-evans/create-or-update-comment@v3 - if: github.event_name == "issue_comment" + if: github.event_name == 'issue_comment' with: issue-number: ${{ env.PR_NUMBER }} edit-mode: replace From d5fc1cf209e7a9711724a2b12d9152f91a4fc8b6 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 18:55:50 +0300 Subject: [PATCH 23/48] final test --- .github/workflows/pr-deploy.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 20bf031f29c02..942c2ee352229 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,7 +73,6 @@ jobs: build: needs: pr_commented - if: false # TODO remove before merging runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" @@ -121,7 +120,7 @@ jobs: deploy: needs: [build, pr_commented] - if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped') # TODO remove before merging + if: needs.build.result == 'success' runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 995ca7a9432ada8fbdb993be1f421b4ddb6eee35 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 26 Jul 2023 20:02:37 +0300 Subject: [PATCH 24/48] setup first user and template and workspace --- .github/workflows/pr-deploy.yaml | 49 ++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 942c2ee352229..49f719be62a6e 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -128,6 +128,7 @@ jobs: PR_TITLE: ${{ needs.pr_commented.outputs.PR_TITLE }} PR_URL: ${{ needs.pr_commented.outputs.PR_URL }} PR_BRANCH: ${{ needs.pr_commented.outputs.PR_BRANCH }} + PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ needs.pr_commented.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" steps: - name: Checkout uses: actions/checkout@v3 @@ -218,6 +219,45 @@ jobs: --namespace "pr${{ env.PR_NUMBER }}" \ --set url="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" + - name: Wait 30 seconds + run: | + sleep 30 + + - name: Create first user, template and workspace + id: setup_deployment + run: | + set -euxo pipefail + + # Create first user + + # create a masked random password 12 characters long + password=$(openssl rand -base64 6 | tr -d "=+/" | cut -c1-12) + + # add mask so that the password is not printed to the logs + echo "::add-mask::$password" + echo "password=$password" >> $GITHUB_OUTPUT + + coder login \ + --first-user-username ${{ env.PR_NUMBER }} \ + --first-user-email ${{ env.PR_NUMBER }}@coder.com \ + --first-user-password $password \ + --first-user-trial \ + --use-token-as-session \ + ${{ env.PR_DEPLOYMENT_ACCESS_URL }} + + # Create template + coder templates init --id kubernetes && cd ./kubernetes/ && coder templates create -y --variable namespace=pr${{ env.PR_NUMBER }} + + # Create workspace + cat < workspace.yaml + cpu: "2" + memory: "4" + home_disk_size: "2" + EOF + + coder create --template="kubernetes" pr${{ env.PR_NUMBER }} --rich-parameter-file ./workspace.yaml -y + coder stop pr${{ env.PR_NUMBER }} -y + - name: Send Slack notification run: | curl -s -o /dev/null -X POST -H 'Content-type: application/json' \ @@ -225,10 +265,11 @@ jobs: "pr_number": "'"${{ env.PR_NUMBER }}"'", "pr_url": "'"${{ env.PR_URL }}"'", "pr_title": "'"${{ env.PR_TITLE }}"'", - "pr_access_url": "'"${{ env.PR_DEPLOYMENT_ACCESS_URL }}"'" }' ${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }} + "pr_access_url": "'"${{ env.PR_DEPLOYMENT_ACCESS_URL }}"'", + "pr_username": "'"${{ env.PR_NUMBER }}"'", + "pr_email": "'"${{ env.PR_NUMBER }}@coder.com"'", + "pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'" }' ${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }} echo "Slack notification sent" - env: - PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - name: Find Comment uses: peter-evans/find-comment@v2 @@ -252,5 +293,3 @@ jobs: :rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }}). :warning: This deployment will be deleted when the PR is closed. reactions: rocket - env: - PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" From 583c213d64ad69e3688be7d354a1c274e4301f00 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:03:21 +0300 Subject: [PATCH 25/48] install coder binary --- .github/workflows/pr-deploy.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 49f719be62a6e..79b001bfea7ce 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,6 +73,7 @@ jobs: build: needs: pr_commented + if: false runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" @@ -120,7 +121,8 @@ jobs: deploy: needs: [build, pr_commented] - if: needs.build.result == 'success' + # if: needs.build.result == 'success' + if: true runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} @@ -162,6 +164,7 @@ jobs: spec: tls: - hosts: + - "${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - "*.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" secretName: pr${{ env.PR_NUMBER }}-tls rules: @@ -223,6 +226,18 @@ jobs: run: | sleep 30 + - name: Get Coder binary + run: | + set -euxo pipefail + ARCH="$(arch)" + PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')" + DEST="${HOME}/coder" + + mkdir -p "$(dirname ${DEST})" + curl -fsSL "${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}" -o "${DEST}" + chmod +x "${DEST}" + "${DEST}" version + - name: Create first user, template and workspace id: setup_deployment run: | @@ -231,7 +246,7 @@ jobs: # Create first user # create a masked random password 12 characters long - password=$(openssl rand -base64 6 | tr -d "=+/" | cut -c1-12) + password=$(openssl rand -base64 16 | tr -d "=+/" | cut -c1-12) # add mask so that the password is not printed to the logs echo "::add-mask::$password" From 37cb2ecda8da458b02c2f30dea7eddd208ef4ebe Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:06:03 +0300 Subject: [PATCH 26/48] deploy on skipped builds too --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 79b001bfea7ce..4993839a18ace 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -122,7 +122,7 @@ jobs: deploy: needs: [build, pr_commented] # if: needs.build.result == 'success' - if: true + if: always() && needs.build.result == 'success' || needs.build.result == 'skipped' runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 24ccb0a320e8fb2d7adef2560ce139bd82790704 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:16:25 +0300 Subject: [PATCH 27/48] use retry --- .github/workflows/pr-deploy.yaml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 4993839a18ace..8a1fb289c5f0d 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -222,19 +222,28 @@ jobs: --namespace "pr${{ env.PR_NUMBER }}" \ --set url="https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" - - name: Wait 30 seconds - run: | - sleep 30 - - name: Get Coder binary run: | set -euxo pipefail ARCH="$(arch)" PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')" DEST="${HOME}/coder" + URL="${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}" mkdir -p "$(dirname ${DEST})" - curl -fsSL "${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}" -o "${DEST}" + + COUNT=0 + until $(curl --output /dev/null --silent --head --fail "$URL"); do + printf '.' + sleep 5 + COUNT=$((COUNT+1)) + if [ $COUNT -ge 60 ]; then + echo "Timed out waiting for URL to be available" + exit 1 + fi + done + + curl -fsSL "$URL" -o "${DEST}" chmod +x "${DEST}" "${DEST}" version From 2598dc0238c7e65282807ba5f17a0ae0f3dd4c1f Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:20:17 +0300 Subject: [PATCH 28/48] fix ARCH --- .github/workflows/pr-deploy.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 8a1fb289c5f0d..c73a3d225bb77 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -225,10 +225,9 @@ jobs: - name: Get Coder binary run: | set -euxo pipefail - ARCH="$(arch)" - PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')" + DEST="${HOME}/coder" - URL="${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-${PLATFORM}-${ARCH}" + URL="${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-linux-amd64" mkdir -p "$(dirname ${DEST})" From e756563399a3a70105f56f7f5849558ae597f5eb Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:22:48 +0300 Subject: [PATCH 29/48] use full path of binary --- .github/workflows/pr-deploy.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index c73a3d225bb77..5442c11d2d975 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -260,7 +260,7 @@ jobs: echo "::add-mask::$password" echo "password=$password" >> $GITHUB_OUTPUT - coder login \ + /home/runner/coder login \ --first-user-username ${{ env.PR_NUMBER }} \ --first-user-email ${{ env.PR_NUMBER }}@coder.com \ --first-user-password $password \ @@ -269,7 +269,7 @@ jobs: ${{ env.PR_DEPLOYMENT_ACCESS_URL }} # Create template - coder templates init --id kubernetes && cd ./kubernetes/ && coder templates create -y --variable namespace=pr${{ env.PR_NUMBER }} + /home/runner/coder templates init --id kubernetes && cd ./kubernetes/ && /home/runner/coder templates create -y --variable namespace=pr${{ env.PR_NUMBER }} # Create workspace cat < workspace.yaml @@ -278,8 +278,8 @@ jobs: home_disk_size: "2" EOF - coder create --template="kubernetes" pr${{ env.PR_NUMBER }} --rich-parameter-file ./workspace.yaml -y - coder stop pr${{ env.PR_NUMBER }} -y + /home/runner/coder create --template="kubernetes" pr${{ env.PR_NUMBER }} --rich-parameter-file ./workspace.yaml -y + /home/runner/coder stop pr${{ env.PR_NUMBER }} -y - name: Send Slack notification run: | From 8dc3c9937904796f5feedecaa59290928d052131 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:44:41 +0300 Subject: [PATCH 30/48] enable build job --- .github/workflows/pr-deploy.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 5442c11d2d975..400408827ad2f 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,7 +73,6 @@ jobs: build: needs: pr_commented - if: false runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" @@ -121,8 +120,7 @@ jobs: deploy: needs: [build, pr_commented] - # if: needs.build.result == 'success' - if: always() && needs.build.result == 'success' || needs.build.result == 'skipped' + if: needs.build.result == 'success' runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From a611b895852b51ed69fcbdc580acfaad811aad0d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 08:46:25 +0300 Subject: [PATCH 31/48] change username to prnumber --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 400408827ad2f..88a6f5dbc10fb 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -259,7 +259,7 @@ jobs: echo "password=$password" >> $GITHUB_OUTPUT /home/runner/coder login \ - --first-user-username ${{ env.PR_NUMBER }} \ + --first-user-username pr${{ env.PR_NUMBER }} \ --first-user-email ${{ env.PR_NUMBER }}@coder.com \ --first-user-password $password \ --first-user-trial \ From 3bd1631f996e6f5f3b5b8451526e0fc1ecb32d9c Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 09:34:59 +0300 Subject: [PATCH 32/48] add actor --- .github/workflows/pr-deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 88a6f5dbc10fb..ada95b8aeef4a 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -287,7 +287,8 @@ jobs: "pr_url": "'"${{ env.PR_URL }}"'", "pr_title": "'"${{ env.PR_TITLE }}"'", "pr_access_url": "'"${{ env.PR_DEPLOYMENT_ACCESS_URL }}"'", - "pr_username": "'"${{ env.PR_NUMBER }}"'", + "pr_actor": "'"${{ github.actor }}"' + "pr_username": "'"pr${{ env.PR_NUMBER }}"'", "pr_email": "'"${{ env.PR_NUMBER }}@coder.com"'", "pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'" }' ${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }} echo "Slack notification sent" From 61b2a9117dd73b6e128ac139c7d04f32a7fe7288 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 09:35:58 +0300 Subject: [PATCH 33/48] Create deploy-pr.sh --- scripts/deploy-pr.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/deploy-pr.sh diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh new file mode 100644 index 0000000000000..ce2dd7ce1706c --- /dev/null +++ b/scripts/deploy-pr.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Usage: ./deploy-pr.sh +# deploys the current branch to a PR environment and posts login credentials to [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel +branchName=$(gh pr view --json headRefName | jq -r .headRefName) +if [[ "$branchName" == "main" ]]; then + # get commit sha --short + commitSha=$(git rev-parse --short HEAD) + gh workflow run pr-deploy.yaml / + --ref $branchName / + -f pr_number=${commitSha} +else + prNumber=$(gh pr view --json number | jq -r .number) + gh workflow run pr-deploy.yaml / + --ref $branchName / + -f pr_number=${prNumber} From 806b18e0e618c835dc497c3b9a0e915be736206c Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 09:37:41 +0300 Subject: [PATCH 34/48] fix EOF --- scripts/deploy-pr.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index ce2dd7ce1706c..948f6a9697f43 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -13,3 +13,4 @@ else gh workflow run pr-deploy.yaml / --ref $branchName / -f pr_number=${prNumber} +fi From 505fd452821e636009a5b6d58eb13344e6557174 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 09:38:27 +0300 Subject: [PATCH 35/48] update --- scripts/deploy-pr.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 948f6a9697f43..87f35ddb225cf 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # Usage: ./deploy-pr.sh # deploys the current branch to a PR environment and posts login credentials to [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel +set -euox pipefail + branchName=$(gh pr view --json headRefName | jq -r .headRefName) if [[ "$branchName" == "main" ]]; then # get commit sha --short From 01c748525f91c648c1f4a05b78a6dfa3aa12dfae Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 09:56:09 +0300 Subject: [PATCH 36/48] refactor --- scripts/deploy-pr.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 87f35ddb225cf..7547917c44950 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -4,15 +4,9 @@ set -euox pipefail branchName=$(gh pr view --json headRefName | jq -r .headRefName) + if [[ "$branchName" == "main" ]]; then - # get commit sha --short - commitSha=$(git rev-parse --short HEAD) - gh workflow run pr-deploy.yaml / - --ref $branchName / - -f pr_number=${commitSha} + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) else - prNumber=$(gh pr view --json number | jq -r .number) - gh workflow run pr-deploy.yaml / - --ref $branchName / - -f pr_number=${prNumber} + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) fi From ebe7b19df6cae9996242244b03c786447f3da7b7 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 10:19:40 +0300 Subject: [PATCH 37/48] make fmt --- scripts/deploy-pr.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 7547917c44950..bafcb379fa4c4 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -6,7 +6,7 @@ set -euox pipefail branchName=$(gh pr view --json headRefName | jq -r .headRefName) if [[ "$branchName" == "main" ]]; then - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) else - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) fi From 41b36d1a3893961f56f80a9975db3a49f670670e Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 11:23:52 +0300 Subject: [PATCH 38/48] add skipping build --- .github/workflows/pr-deploy.yaml | 10 +++++++++- scripts/deploy-pr.sh | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index ada95b8aeef4a..515f96df0ea41 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -8,6 +8,10 @@ on: pr_number: description: "PR number" required: true + skip_build: + description: "Skip build job" + required: false + default: false env: REPO: ghcr.io/coder/coder-preview @@ -73,6 +77,9 @@ jobs: build: needs: pr_commented + # Skips the build job if the workflow was triggered by a workflow_dispatch event and the skip_build input is set to true + # or if the workflow was triggered by an issue_comment event and the comment body contains --skip-build + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_build == 'false') || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '--skip-build') != true) runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" @@ -120,7 +127,8 @@ jobs: deploy: needs: [build, pr_commented] - if: needs.build.result == 'success' + # Run deploy job only if build job was successful or skipped but not if it failed + if: needs.build.result != 'failure' && needs.build.result != 'cancelled' runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index bafcb379fa4c4..1cef8f2755fe1 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -1,12 +1,20 @@ #!/usr/bin/env bash -# Usage: ./deploy-pr.sh -# deploys the current branch to a PR environment and posts login credentials to [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel +# Usage: ./deploy-pr.sh --skip-build +# deploys the current branch to a PR environment and posts login credentials to +# [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel +# if --skip-build is passed, the build step will be skipped and the last build image will be used + set -euox pipefail +# if --skip-build is passed, the build step will be skipped and the last build image will be used +if [[ "$*" == *--skip-build* ]]; then + skipBuild=true +fi + branchName=$(gh pr view --json headRefName | jq -r .headRefName) if [[ "$branchName" == "main" ]]; then - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) -f skip_build=$skipBuild else - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) + gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) -f skip_build=$skipBuild fi From d65d058042a8061f895e3e6643d8912c0a001f48 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 11:29:55 +0300 Subject: [PATCH 39/48] garmmer --- scripts/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 1cef8f2755fe1..9db2e747e1cde 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -6,7 +6,7 @@ set -euox pipefail -# if --skip-build is passed, the build step will be skipped and the last build image will be used +# if --skip-build is passed, the build job will be skipped and the last built image will be used if [[ "$*" == *--skip-build* ]]; then skipBuild=true fi From df92ca7a43076f84247685def066bf515b3b3f1d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 11:34:16 +0300 Subject: [PATCH 40/48] fix ci --- .github/workflows/pr-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 515f96df0ea41..4f707d7b421d5 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -127,8 +127,8 @@ jobs: deploy: needs: [build, pr_commented] - # Run deploy job only if build job was successful or skipped but not if it failed - if: needs.build.result != 'failure' && needs.build.result != 'cancelled' + # Run deploy job only if build job was successful or skipped + if: needs.build.result == 'success' || needs.build.result == 'skipped' runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 9616eca724e5275376c7fb1278a89e58ccc1c05d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 11:40:02 +0300 Subject: [PATCH 41/48] fixup --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 4f707d7b421d5..afbf68044f965 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -128,7 +128,7 @@ jobs: deploy: needs: [build, pr_commented] # Run deploy job only if build job was successful or skipped - if: needs.build.result == 'success' || needs.build.result == 'skipped' + if: always() && !failed() && !cancelled() runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 0711999e57b54246c399aee71aee657df9e86106 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 11:40:50 +0300 Subject: [PATCH 42/48] fix --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index afbf68044f965..8d04781987254 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -128,7 +128,7 @@ jobs: deploy: needs: [build, pr_commented] # Run deploy job only if build job was successful or skipped - if: always() && !failed() && !cancelled() + if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped') runs-on: "ubuntu-latest" env: CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }} From 521712b0df208669a3c9a4cf3f7f384bea576012 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 12:19:11 +0300 Subject: [PATCH 43/48] inform if image not found --- .github/workflows/pr-deploy.yaml | 11 +++++++++++ scripts/deploy-pr.sh | 26 +++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 8d04781987254..fd9c6b44cf464 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -138,6 +138,17 @@ jobs: PR_BRANCH: ${{ needs.pr_commented.outputs.PR_BRANCH }} PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ needs.pr_commented.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" steps: + - name: Check if image exists + run: | + set -euxo pipefail + foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o ${{ env.CODER_IMAGE_TAG }} | head -n 1) + if [ -z "$foundTag" ]; then + echo "Image not found" + echo "${{ env.CODER_IMAGE_TAG }} not found in ghcr.io/coder/coder-preview" + echo "Please remove --skip-build from the comment or ./scripts/deploy-pr.sh" + exit 1 + fi + - name: Checkout uses: actions/checkout@v3 with: diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 9db2e747e1cde..173d9918c5a37 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -6,15 +6,27 @@ set -euox pipefail -# if --skip-build is passed, the build job will be skipped and the last built image will be used -if [[ "$*" == *--skip-build* ]]; then - skipBuild=true -fi - branchName=$(gh pr view --json headRefName | jq -r .headRefName) if [[ "$branchName" == "main" ]]; then - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(git rev-parse --short HEAD) -f skip_build=$skipBuild + prNumber=$(git rev-parse --short HEAD) +else + prNumber=$(gh pr view --json number | jq -r .number) +fi + +# if --skip-build is passed, the build job will be skipped and the last built image will be used +if [[ "$*" == *--skip-build* ]]; then + skipBuild=true + #check if the image exists + foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o $prNumber | head -n 1) + if [ -z "$foundTag" ]; then + echo "Image not found" + echo "$prNumber tag not found in ghcr.io/coder/coder-preview" + echo "Please remove --skip-build and try again" + exit 1 + fi else - gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$(gh pr view --json number | jq -r .number) -f skip_build=$skipBuild + skipBuild=false fi + +gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$imageTag -f image_tag=$imageTag -f skip_build=$skipBuild From c72a04c514060eb8688272eb09ac0e9325e13142 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 12:23:38 +0300 Subject: [PATCH 44/48] quotes --- scripts/deploy-pr.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 173d9918c5a37..90cc678c705ce 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -18,10 +18,10 @@ fi if [[ "$*" == *--skip-build* ]]; then skipBuild=true #check if the image exists - foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o $prNumber | head -n 1) + foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o "$prNumber" | head -n 1) if [ -z "$foundTag" ]; then echo "Image not found" - echo "$prNumber tag not found in ghcr.io/coder/coder-preview" + echo ""$prNumber" tag not found in ghcr.io/coder/coder-preview" echo "Please remove --skip-build and try again" exit 1 fi @@ -29,4 +29,4 @@ else skipBuild=false fi -gh workflow run pr-deploy.yaml --ref $branchName -f pr_number=$imageTag -f image_tag=$imageTag -f skip_build=$skipBuild +gh workflow run pr-deploy.yaml --ref "$branchName" -f pr_number="$imageTag" -f skip_build="$skipBuild" From b672c67968834b8c55897a87b3f7392f41a42a59 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 27 Jul 2023 09:24:43 +0000 Subject: [PATCH 45/48] fmt --- scripts/deploy-pr.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 90cc678c705ce..4ca77962056a8 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Usage: ./deploy-pr.sh --skip-build -# deploys the current branch to a PR environment and posts login credentials to +# deploys the current branch to a PR environment and posts login credentials to # [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel # if --skip-build is passed, the build step will be skipped and the last build image will be used @@ -9,24 +9,24 @@ set -euox pipefail branchName=$(gh pr view --json headRefName | jq -r .headRefName) if [[ "$branchName" == "main" ]]; then - prNumber=$(git rev-parse --short HEAD) + prNumber=$(git rev-parse --short HEAD) else - prNumber=$(gh pr view --json number | jq -r .number) + prNumber=$(gh pr view --json number | jq -r .number) fi # if --skip-build is passed, the build job will be skipped and the last built image will be used if [[ "$*" == *--skip-build* ]]; then - skipBuild=true - #check if the image exists - foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o "$prNumber" | head -n 1) - if [ -z "$foundTag" ]; then - echo "Image not found" - echo ""$prNumber" tag not found in ghcr.io/coder/coder-preview" - echo "Please remove --skip-build and try again" - exit 1 - fi + skipBuild=true + #check if the image exists + foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o "$prNumber" | head -n 1) + if [ -z "$foundTag" ]; then + echo "Image not found" + echo ""$prNumber" tag not found in ghcr.io/coder/coder-preview" + echo "Please remove --skip-build and try again" + exit 1 + fi else - skipBuild=false + skipBuild=false fi gh workflow run pr-deploy.yaml --ref "$branchName" -f pr_number="$imageTag" -f skip_build="$skipBuild" From 25b22e463f60337fe91563a9bf4981610b307a83 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 27 Jul 2023 09:27:19 +0000 Subject: [PATCH 46/48] lint --- scripts/deploy-pr.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh index 4ca77962056a8..cd847a5b25591 100644 --- a/scripts/deploy-pr.sh +++ b/scripts/deploy-pr.sh @@ -19,9 +19,9 @@ if [[ "$*" == *--skip-build* ]]; then skipBuild=true #check if the image exists foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o "$prNumber" | head -n 1) - if [ -z "$foundTag" ]; then + if [ -z "${foundTag}" ]; then echo "Image not found" - echo ""$prNumber" tag not found in ghcr.io/coder/coder-preview" + echo "${prNumber} tag not found in ghcr.io/coder/coder-preview" echo "Please remove --skip-build and try again" exit 1 fi @@ -29,4 +29,4 @@ else skipBuild=false fi -gh workflow run pr-deploy.yaml --ref "$branchName" -f pr_number="$imageTag" -f skip_build="$skipBuild" +gh workflow run pr-deploy.yaml --ref "${branchName}" -f pr_number="${prNumber}" -f skip_build="${skipBuild}" From 75cd788034cf5bbb67e57ad81523b407543ec8d7 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 27 Jul 2023 09:28:58 +0000 Subject: [PATCH 47/48] make executable --- scripts/deploy-pr.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/deploy-pr.sh diff --git a/scripts/deploy-pr.sh b/scripts/deploy-pr.sh old mode 100644 new mode 100755 From 92d307d5f1d61c08637a7e1972b7f1254ea5268e Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 27 Jul 2023 12:42:24 +0300 Subject: [PATCH 48/48] fix slack notfication payload --- .github/workflows/pr-deploy.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index fd9c6b44cf464..95485abfbe898 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -301,15 +301,18 @@ jobs: - name: Send Slack notification run: | curl -s -o /dev/null -X POST -H 'Content-type: application/json' \ - -d '{ - "pr_number": "'"${{ env.PR_NUMBER }}"'", - "pr_url": "'"${{ env.PR_URL }}"'", - "pr_title": "'"${{ env.PR_TITLE }}"'", - "pr_access_url": "'"${{ env.PR_DEPLOYMENT_ACCESS_URL }}"'", - "pr_actor": "'"${{ github.actor }}"' - "pr_username": "'"pr${{ env.PR_NUMBER }}"'", - "pr_email": "'"${{ env.PR_NUMBER }}@coder.com"'", - "pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'" }' ${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }} + -d \ + '{ + "pr_number": "'"${{ env.PR_NUMBER }}"'", + "pr_url": "'"${{ env.PR_URL }}"'", + "pr_title": "'"${{ env.PR_TITLE }}"'", + "pr_access_url": "'"${{ env.PR_DEPLOYMENT_ACCESS_URL }}"'", + "pr_username": "'"pr${{ env.PR_NUMBER }}"'", + "pr_email": "'"${{ env.PR_NUMBER }}@coder.com"'", + "pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'", + "pr_actor": "'"${{ github.actor }}"'" + }' \ + ${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }} echo "Slack notification sent" - name: Find Comment