Skip to content

docs: add guide for CI/CD template testing #15528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
  • Loading branch information
matifali and EdwardAngert authored Nov 19, 2024
commit c01ec95435880da7ce0e75d7d624949a8c929394
2 changes: 1 addition & 1 deletion docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@
"path": "./tutorials/cloning-git-repositories.md"
},
{
"title": "Testing Templates",
"title": "Test Templates Through CI/CD",
"description": "Learn how to test and publish Coder templates in a CI/CD pipeline",
"path": "./tutorials/testing-templates.md"
},
Expand Down
29 changes: 11 additions & 18 deletions docs/tutorials/testing-templates.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Testing and Publishing Coder Templates in CI/CD
# Test and Publish Coder Templates Through CI/CD

<div>
<a href="https://github.com/matifali" style="text-decoration: none; color: inherit;">
Expand All @@ -19,28 +19,21 @@ ensures your templates are validated, tested, and promoted seamlessly.

## Prerequisites

Before proceeding, ensure the following:

- **Coder CLI** is installed and configured in your environment.
- **Terraform CLI** is installed and available in your CI environment.
- Access to your **Coder instance** with the appropriate
[permissions](../admin/users/groups-roles.md#roles).
- Install and configure Coder CLI in your environment.
- Install Terraform CLI in your CI environment.
- Configure [user roles and permissions](../admin/users/groups-roles.md#roles) for your Coder instance.

## Example GitHub Action Workflow

Below is an example workflow for testing and publishing a template using GitHub
Actions. The workflow first validates the Terraform template, pushes the
template to Coder without activating it, tests the template by creating a
workspace, and then promotes the template version to active upon successful
workspace creation.
This example workflow tests and publishes a template using GitHub
Actions.

### Step-by-Step Process
The workflow:

1. **Validate the Terraform template.**
2. **Push the template to Coder without activating it.**
3. **Test the template by creating a workspace.**
4. **Promote the template version to active upon successful workspace
creation.**
1. Validates the Terraform template.
1. Pushes the template to Coder without activating it.
1. Tests the template by creating a workspace.
1. Promotes the template version to active upon successful workspace creation.

### Workflow File

Expand Down
Loading