From 552d211e35e36337679681659158b53ef034f691 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 27 Jan 2024 05:09:42 +0300 Subject: [PATCH 1/5] ci: validate template before pushing Fixes #11866 --- .github/workflows/dogfood.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dogfood.yaml b/.github/workflows/dogfood.yaml index be349833a60e4..5b078dc0ff095 100644 --- a/.github/workflows/dogfood.yaml +++ b/.github/workflows/dogfood.yaml @@ -58,26 +58,38 @@ jobs: deploy_template: needs: build_image - if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + + - name: Setup Terraform + uses: ./.github/actions/setup-tf + + - name: Terraform init and validate + run: | + cd dogfood + terraform init -upgrade + terrafrom validate - name: Get short commit SHA + if: github.ref == 'refs/heads/main' id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Get latest commit title + if: github.ref == 'refs/heads/main' id: message run: echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT - name: "Get latest Coder binary from the server" + if: github.ref == 'refs/heads/main' run: | curl -fsSL "https://dev.coder.com/bin/coder-linux-amd64" -o "./coder" chmod +x "./coder" - + - name: "Push template" + if: github.ref == 'refs/heads/main' run: | ./coder templates push $CODER_TEMPLATE_NAME --directory $CODER_TEMPLATE_DIR --yes --name=$CODER_TEMPLATE_VERSION --message="$CODER_TEMPLATE_MESSAGE" --variable jfrog_url=${{ secrets.JFROG_URL }} env: From 89841485bef3015bc8e007ff58a5055ce668582c Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 27 Jan 2024 05:11:30 +0300 Subject: [PATCH 2/5] fmt --- .github/workflows/dogfood.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dogfood.yaml b/.github/workflows/dogfood.yaml index 5b078dc0ff095..67b9df730472a 100644 --- a/.github/workflows/dogfood.yaml +++ b/.github/workflows/dogfood.yaml @@ -87,7 +87,7 @@ jobs: run: | curl -fsSL "https://dev.coder.com/bin/coder-linux-amd64" -o "./coder" chmod +x "./coder" - + - name: "Push template" if: github.ref == 'refs/heads/main' run: | From a6eb79a404b0a1626cc67fda211477c5b29ce418 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 27 Jan 2024 05:14:31 +0300 Subject: [PATCH 3/5] typo --- .github/workflows/dogfood.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dogfood.yaml b/.github/workflows/dogfood.yaml index 67b9df730472a..bbeb00bd303b1 100644 --- a/.github/workflows/dogfood.yaml +++ b/.github/workflows/dogfood.yaml @@ -70,7 +70,7 @@ jobs: run: | cd dogfood terraform init -upgrade - terrafrom validate + terraform validate - name: Get short commit SHA if: github.ref == 'refs/heads/main' From 6e1530ba7626e28a872a4198be61a14b0ea80914 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 27 Jan 2024 05:20:58 +0300 Subject: [PATCH 4/5] Update main.tf --- dogfood/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dogfood/main.tf b/dogfood/main.tf index 1708169c59cab..0abfdcadd20e0 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -103,7 +103,7 @@ module "git-clone" { version = "1.0.2" agent_id = coder_agent.dev.id url = "https://github.com/coder/coder" - path = local.repo_base_dir + base_dir = local.repo_base_dir } module "personalize" { From 0aa2303a167fb4eafadda1378cb7ba93b2bd348c Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 27 Jan 2024 02:32:57 +0000 Subject: [PATCH 5/5] `make fmt` --- .github/workflows/dogfood.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dogfood.yaml b/.github/workflows/dogfood.yaml index bbeb00bd303b1..751eaaa91308f 100644 --- a/.github/workflows/dogfood.yaml +++ b/.github/workflows/dogfood.yaml @@ -62,7 +62,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Setup Terraform uses: ./.github/actions/setup-tf