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
Prev Previous commit
docs: update CLI instructions and link setup-coder
Clarified CLI installation instructions for pushing template versions
and linked to the GitHub Actions setup-coder for automation. Removed
redundant setup-action note and added details on creating a headless
user for CI workflows.
  • Loading branch information
matifali committed Nov 20, 2024
commit fa904b26b437f52c7b35cef8dadf842ab845deef
8 changes: 3 additions & 5 deletions docs/admin/templates/managing-templates/change-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ For an example, see how we push our development image and template

## Coder CLI

You can also [install Coder](../../../install/cli.md) to automate pushing new
template versions in CI/CD pipelines.
You can [install Coder](../../../install/cli.md) CLI to automate pushing new
template versions in CI/CD pipelines. For GitHub Actions, see our
[setup-coder](https://github.com/coder/setup-coder) action.

```console
# Install the Coder CLI
Expand All @@ -88,9 +89,6 @@ coder templates push --yes $CODER_TEMPLATE_NAME \
--name=$CODER_TEMPLATE_VERSION # Version name is optional
```

You can also use the [coder/setup-action](https://github.com/coder/setup-coder)
GitHub Action to install the Coder CLI and push new template versions.

## Testing and Publishing Coder Templates in CI/CD

See our [testing templates](../../../tutorials/testing-templates.md) tutorial
Expand Down
17 changes: 15 additions & 2 deletions docs/tutorials/testing-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ ensures your templates are validated, tested, and promoted seamlessly.

- 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.
- Create a [headless user](../admin/users/headless-auth.md) with the
[user roles and permissions](../admin/users/groups-roles.md#roles) to manage
templates and run workspaces.

## Creating the headless user

```shell
coder users create \
--username machine-user \
--email machine-user@example.com \
--login-type none

coder tokens create --user machine-user --lifetime 8760h
# Copy the token and store it in a secret in your CI environment with the name `CODER_SESSION_TOKEN`
```

## Example GitHub Action Workflow

Expand Down
Loading