Coder.comC
Coder.com2w ago
4 replies
djomboUnchained

How to pass workspace parameters to coder tasks at prompt?

The docker example for coder tasks has the git repo URL hardcoded in the template. I have existing workspace templates that I'm converting to coder task templates, but the task section of the web UI does not expose any of the input parameters of the workspace, most importantly a "git repo URL" parameter. This lets the workspace clone the relevant git repo to work with at startup.

Without this, I would have to make a new coder task template for every git repo I want to work with in tasks. Is there something I'm missing, or this is how the tasks feature works at this time?

Some "workarounds" I've thought of:

1. Include an instruction in the prompt to clone the git repo as the first step. This relies on the LLM correctly parsing and executing the git clone command before starting work, and is less deterministic.
2. Hack this by using a regex in the terraform template to extract the git repo URL from the prompt (like looking for a pattern such as coder_parameter_git_repo_url: https://... inside the prompt text and establishing a terraform local value for use within the template, like for doing git clone within the workspace startup script.

What is the recommended way to re-use a coder task template across git repositories?

Running coder version: v2.29.1+59cdd7e
Was this page helpful?