-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(scripts): create both docker and tasks-docker templates by default for develop.sh #21184
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
base: main
Are you sure you want to change the base?
Conversation
|
I have confirmed this works! |
a82d8b2 to
34d30a5
Compare
Add a --with-tasks flag to develop.sh that automatically sets up a tasks-compatible development environment. When enabled, it creates the tasks-docker template and pulls the required container image in the background to speed up workspace creation. The flag also sets a blank access URL to enable tunnel mode, which provides automatic subdomain support for workspace apps without requiring wildcard-access-url configuration. Updated the dogfood template to use this flag by default, making it easier to develop Coder Tasks features using Tasks itself. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The DOCKER_HOST variable was being set but not passed to the template. This commit: - Creates params.yaml with docker_socket parameter - Passes params.yaml via --variables-file flag to both template pushes - Adds docker_socket variable to tasks-docker template matching docker template pattern This ensures the template can connect to non-default Docker sockets when needed.
Per Dean's feedback, remove the --with-tasks flag and always create both the docker and tasks-docker templates in develop.sh. This provides a better developer experience by making the tasks-docker template available without requiring a flag. Changes: - Remove --with-tasks flag and associated argument parsing - Always create both docker and tasks-docker templates when docker is available - Pull container image in background for tasks-docker to speed up workspace creation - Update dogfood template to remove --with-tasks usage (no longer needed)
The main.tf changes were unrelated to this PR. Reverting to match main branch exactly.
4e115ea to
f98cf44
Compare
Addresses Dean's code review feedback: - Remove redundant first_org_name variable in tasks-docker section (already defined in docker section above) - Extract template pushing logic into a shared push_template() function to reduce code duplication between docker and tasks-docker template creation
…late The tasks-docker example template doesn't need custom docker socket configuration - it works fine with the default docker provider configuration. Removed the docker_socket variable addition and updated push_template() function to optionally use params.yaml only when it exists.
|
|
||
| DOCKER_HOST="$(docker context inspect --format '{{ .Endpoints.docker.Host }}')" | ||
| printf 'docker_arch: "%s"\ndocker_host: "%s"\n' "${GOARCH}" "${DOCKER_HOST}" >"${temp_template_dir}/params.yaml" | ||
| ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal but the parenthesis are not required anymore.
| if docker info >/dev/null 2>&1 && ! "${CODER_DEV_SHIM}" templates versions list "${template_name}" >/dev/null 2>&1; then | ||
| # sometimes terraform isn't installed yet when we go to create the | ||
| # template | ||
| echo "Waiting for terraform to be installed..." | ||
| sleep 5 | ||
|
|
||
| echo "Initializing tasks-docker template..." | ||
|
|
||
| # Pull the container image in the background to speed up workspace creation | ||
| container_image="codercom/example-universal:ubuntu" | ||
| echo "Pulling container image ${container_image} in background..." | ||
| docker pull "${container_image}" >/dev/null 2>&1 & | ||
|
|
||
| # Create template from the examples directory | ||
| temp_template_dir="$(mktemp -d)" | ||
| cp -r "${PROJECT_ROOT}/examples/templates/tasks-docker/"* "${temp_template_dir}/" | ||
|
|
||
| # Run terraform init so we get a terraform.lock.hcl | ||
| pushd "${temp_template_dir}" && terraform init && popd | ||
|
|
||
| ( | ||
| push_template "${template_name}" "${temp_template_dir}" "${first_org_name}" "${another_org}" | ||
| ) || echo "Failed to create tasks-docker template. The template files are in ${temp_template_dir}" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not make the regular docker template the same as this? It's missing the terraform check, the background pulling, the terraform init. It'd be nice if these could just be identical and just be ~two lines
| # sometimes terraform isn't installed yet when we go to create the | ||
| # template | ||
| echo "Waiting for terraform to be installed..." | ||
| sleep 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a (bounded) loop with command -v terraform or something to test for it being installed rather than a sleep
Remove the
--with-tasksflag and always create both docker and tasks-docker templates in develop.sh. This provides a better developer experience by making the tasks-docker template available automatically without requiring a flag.When docker is available, the script now:
examples/templates/tasks-dockercodercom/example-universal:ubuntu) in the background to speed up workspace creation🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com