Skip to content

Commit c391303

Browse files
committed
Update manifest to include testing templates guide
Add a new entry in the documentation's manifest for a tutorial on testing and publishing Coder templates in a CI/CD pipeline.
1 parent 172e7b8 commit c391303

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

docs/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,11 @@
709709
"description": "Learn how to clone Git repositories in Coder",
710710
"path": "./tutorials/cloning-git-repositories.md"
711711
},
712+
{
713+
"title": "Testing Templates",
714+
"description": "Learn how to test and publish Coder templates in a CI/CD pipeline",
715+
"path": "./tutorials/testing-templates.md"
716+
},
712717
{
713718
"title": "Use Apache as a Reverse Proxy",
714719
"description": "Learn how to use Apache as a reverse proxy",

docs/tutorials/testing-templates.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Before proceeding, ensure the following:
2424
- **Coder CLI** is installed and configured in your environment.
2525
- **Terraform CLI** is installed and available in your CI environment.
2626
- Access to your **Coder instance** with the appropriate
27-
[permissions](../admin/users/groups-roles#roles).
27+
[permissions](../admin/users/groups-roles.md#roles).
2828

2929
## Example GitHub Action Workflow
3030

@@ -44,8 +44,8 @@ workspace creation.
4444

4545
### Workflow File
4646

47-
Save the following workflow file as `.github/workflows/template-ci.yaml` in your
48-
repository:
47+
Save the following workflow file as `.github/workflows/publish-template.yaml` in
48+
your repository:
4949

5050
```yaml
5151
name: Test and Publish Coder Template
@@ -59,8 +59,8 @@ on:
5959
jobs:
6060
test-and-publish:
6161
runs-on: ubuntu-latest
62-
env:
63-
TEMPLATE_NAME: "my-template"
62+
env:
63+
TEMPLATE_NAME: "my-template"
6464
steps:
6565
- name: Checkout repository
6666
uses: actions/checkout@v4
@@ -73,8 +73,8 @@ jobs:
7373
- name: Set up Coder CLI
7474
uses: coder/setup-action@v1
7575
with:
76-
access_url: 'https://coder.example.com'
77-
coder_session_token: ${{ secrets.CODER_SESSION_TOKEN }}
76+
access_url: "https://coder.example.com"
77+
coder_session_token: ${{ secrets.CODER_SESSION_TOKEN }}
7878

7979
- name: Validate Terraform template
8080
run: terraform validate
@@ -85,11 +85,13 @@ jobs:
8585

8686
- name: Get latest commit title to use as template version description
8787
id: message
88-
run: echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT
88+
run:
89+
echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >>
90+
$GITHUB_OUTPUT
8991

9092
- name: Push template to Coder
9193
run: |
92-
coder templates push $TEMPLATE_NAME --activate=false --name ${{ steps.name.outputs.version_name }} --message ${{ steps.message.outputs.pr_title }} --yes
94+
coder templates push $TEMPLATE_NAME --activate=false --name ${{ steps.name.outputs.version_name }} --message "${{ steps.message.outputs.pr_title }}" --yes
9395
9496
- name: Create a test workspace
9597
run: |
@@ -99,5 +101,4 @@ jobs:
99101
if: success()
100102
run: |
101103
coder template version promote --template=$TEMPLATE_NAME --template-version=${{ steps.name.outputs.version_name }} --yes
102-
103104
```

0 commit comments

Comments
 (0)