2022-10-12 15:43:59 +00:00
|
|
|
# Template Change Management
|
|
|
|
|
2023-10-17 14:47:12 +00:00
|
|
|
We recommend source-controlling your templates as you would other code. You can
|
|
|
|
[install Coder](../install/) in CI/CD pipelines to push new template versions.
|
2022-10-12 15:43:59 +00:00
|
|
|
|
2023-02-01 20:05:45 +00:00
|
|
|
```console
|
2022-10-12 15:43:59 +00:00
|
|
|
# Install the Coder CLI
|
|
|
|
curl -L https://coder.com/install.sh | sh
|
|
|
|
# curl -L https://coder.com/install.sh | sh -s -- --version=0.x
|
|
|
|
|
|
|
|
# To create API tokens, use `coder tokens create`.
|
2023-03-07 14:35:48 +00:00
|
|
|
# If no `--lifetime` flag is passed during creation, the default token lifetime
|
|
|
|
# will be 30 days.
|
2022-10-12 15:43:59 +00:00
|
|
|
# These variables are consumed by Coder
|
|
|
|
export CODER_URL=https://coder.example.com
|
|
|
|
export CODER_SESSION_TOKEN=*****
|
|
|
|
|
|
|
|
# Template details
|
|
|
|
export CODER_TEMPLATE_NAME=kubernetes
|
|
|
|
export CODER_TEMPLATE_DIR=.coder/templates/kubernetes
|
|
|
|
export CODER_TEMPLATE_VERSION=$(git rev-parse --short HEAD)
|
|
|
|
|
2023-03-02 22:22:53 +00:00
|
|
|
# Push the new template version to Coder
|
2022-10-12 15:43:59 +00:00
|
|
|
coder templates push --yes $CODER_TEMPLATE_NAME \
|
|
|
|
--directory $CODER_TEMPLATE_DIR \
|
|
|
|
--name=$CODER_TEMPLATE_VERSION # Version name is optional
|
|
|
|
```
|
2022-10-20 15:14:06 +00:00
|
|
|
|
2023-10-17 14:47:12 +00:00
|
|
|
To cap token lifetime on creation,
|
|
|
|
[configure Coder server to set a shorter max token lifetime](../cli/server.md#--max-token-lifetime).
|
|
|
|
For an example, see how we push our development image and template
|
|
|
|
[with GitHub actions](https://github.com/coder/coder/blob/main/.github/workflows/dogfood.yaml).
|