Skip to content

Commit 552d211

Browse files
authored
ci: validate template before pushing
Fixes #11866
1 parent de6d479 commit 552d211

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/dogfood.yaml

+14-2
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
65+
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+
terrafrom validate
6674
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"
79-
90+
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:

0 commit comments

Comments
 (0)