Skip to content

Commit 2f9bf1e

Browse files
authored
ci: validate template before pushing (#11867)
1 parent 4825b7c commit 2f9bf1e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/dogfood.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,38 @@ jobs:
5858

5959
deploy_template:
6060
needs: build_image
61-
if: github.ref == 'refs/heads/main'
6261
runs-on: ubuntu-latest
6362
steps:
6463
- name: Checkout
6564
uses: actions/checkout@v4
6665

66+
- name: Setup Terraform
67+
uses: ./.github/actions/setup-tf
68+
69+
- name: Terraform init and validate
70+
run: |
71+
cd dogfood
72+
terraform init -upgrade
73+
terraform validate
74+
6775
- name: Get short commit SHA
76+
if: github.ref == 'refs/heads/main'
6877
id: vars
6978
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
7079

7180
- name: Get latest commit title
81+
if: github.ref == 'refs/heads/main'
7282
id: message
7383
run: echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT
7484

7585
- name: "Get latest Coder binary from the server"
86+
if: github.ref == 'refs/heads/main'
7687
run: |
7788
curl -fsSL "https://dev.coder.com/bin/coder-linux-amd64" -o "./coder"
7889
chmod +x "./coder"
7990
8091
- name: "Push template"
92+
if: github.ref == 'refs/heads/main'
8193
run: |
8294
./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 }}
8395
env:

dogfood/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ module "git-clone" {
103103
version = "1.0.2"
104104
agent_id = coder_agent.dev.id
105105
url = "https://github.com/coder/coder"
106-
path = local.repo_base_dir
106+
base_dir = local.repo_base_dir
107107
}
108108

109109
module "personalize" {

0 commit comments

Comments
 (0)