From 98ae99759b3f1019f92dee4efa4a7366c67fbc4b Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:55:29 +0000 Subject: [PATCH 1/2] feat: add extra_args variable to code-server module Allows users to pass additional command-line arguments to code-server. For example, --disable-workspace-trust can be used to disable the workspace trust prompt. Fixes workspace trust issue by allowing flexible argument passing. --- registry/coder/modules/code-server/README.md | 14 ++++++++++++++ registry/coder/modules/code-server/main.tf | 7 +++++++ registry/coder/modules/code-server/run.sh | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/registry/coder/modules/code-server/README.md b/registry/coder/modules/code-server/README.md index 13fb7b727..2e3a9979b 100644 --- a/registry/coder/modules/code-server/README.md +++ b/registry/coder/modules/code-server/README.md @@ -84,6 +84,20 @@ module "code-server" { } ``` +### Pass Additional Arguments + +You can pass additional command-line arguments to code-server using the `extra_args` variable. For example, to disable workspace trust: + +```tf +module "code-server" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/code-server/coder" + version = "1.3.1" + agent_id = coder_agent.example.id + extra_args = "--disable-workspace-trust" +} +``` + ### Offline and Use Cached Modes By default the module looks for code-server at `/tmp/code-server` but this can be changed with `install_prefix`. diff --git a/registry/coder/modules/code-server/main.tf b/registry/coder/modules/code-server/main.tf index 650829f68..1ef7497f7 100644 --- a/registry/coder/modules/code-server/main.tf +++ b/registry/coder/modules/code-server/main.tf @@ -148,6 +148,12 @@ variable "open_in" { } } +variable "extra_args" { + type = string + description = "Additional command-line arguments to pass to code-server (e.g., '--disable-workspace-trust')." + default = "" +} + resource "coder_script" "code-server" { agent_id = var.agent_id display_name = "code-server" @@ -168,6 +174,7 @@ resource "coder_script" "code-server" { EXTENSIONS_DIR : var.extensions_dir, FOLDER : var.folder, AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions, + EXTRA_ARGS : var.extra_args, }) run_on_start = true diff --git a/registry/coder/modules/code-server/run.sh b/registry/coder/modules/code-server/run.sh index 73bcd6899..a91bba602 100644 --- a/registry/coder/modules/code-server/run.sh +++ b/registry/coder/modules/code-server/run.sh @@ -16,7 +16,7 @@ fi function run_code_server() { echo "👷 Running code-server in the background..." echo "Check logs at ${LOG_PATH}!" - $CODE_SERVER "$EXTENSION_ARG" --auth none --port "${PORT}" --app-name "${APP_NAME}" > "${LOG_PATH}" 2>&1 & + $CODE_SERVER "$EXTENSION_ARG" --auth none --port "${PORT}" --app-name "${APP_NAME}" ${EXTRA_ARGS} > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists... From 0fa5101eeaf654be2e1f0bf1e446a05805b8e3d4 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Wed, 12 Nov 2025 16:43:46 -0600 Subject: [PATCH 2/2] chore: rename extra_args to additional_args in code-server module for consistency and bump version --- registry/coder/modules/code-server/README.md | 26 ++++++++++---------- registry/coder/modules/code-server/main.tf | 4 +-- registry/coder/modules/code-server/run.sh | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/registry/coder/modules/code-server/README.md b/registry/coder/modules/code-server/README.md index 2e3a9979b..b9ed6b72a 100644 --- a/registry/coder/modules/code-server/README.md +++ b/registry/coder/modules/code-server/README.md @@ -14,7 +14,7 @@ Automatically install [code-server](https://github.com/coder/code-server) in a w module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id } ``` @@ -29,7 +29,7 @@ module "code-server" { module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id install_version = "4.8.3" } @@ -43,7 +43,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/): module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id extensions = [ "dracula-theme.theme-dracula" @@ -61,7 +61,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula"] settings = { @@ -78,7 +78,7 @@ Just run code-server in the background, don't fetch it from GitHub: module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"] } @@ -86,15 +86,15 @@ module "code-server" { ### Pass Additional Arguments -You can pass additional command-line arguments to code-server using the `extra_args` variable. For example, to disable workspace trust: +You can pass additional command-line arguments to code-server using the `additional_args` variable. For example, to disable workspace trust: ```tf module "code-server" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" - agent_id = coder_agent.example.id - extra_args = "--disable-workspace-trust" + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/code-server/coder" + version = "1.4.0" + agent_id = coder_agent.example.id + additional_args = "--disable-workspace-trust" } ``` @@ -108,7 +108,7 @@ Run an existing copy of code-server if found, otherwise download from GitHub: module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id use_cached = true extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"] @@ -121,7 +121,7 @@ Just run code-server in the background, don't fetch it from GitHub: module "code-server" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "1.3.1" + version = "1.4.0" agent_id = coder_agent.example.id offline = true } diff --git a/registry/coder/modules/code-server/main.tf b/registry/coder/modules/code-server/main.tf index 1ef7497f7..f56513533 100644 --- a/registry/coder/modules/code-server/main.tf +++ b/registry/coder/modules/code-server/main.tf @@ -148,7 +148,7 @@ variable "open_in" { } } -variable "extra_args" { +variable "additional_args" { type = string description = "Additional command-line arguments to pass to code-server (e.g., '--disable-workspace-trust')." default = "" @@ -174,7 +174,7 @@ resource "coder_script" "code-server" { EXTENSIONS_DIR : var.extensions_dir, FOLDER : var.folder, AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions, - EXTRA_ARGS : var.extra_args, + ADDITIONAL_ARGS : var.additional_args, }) run_on_start = true diff --git a/registry/coder/modules/code-server/run.sh b/registry/coder/modules/code-server/run.sh index a91bba602..55918fa4f 100644 --- a/registry/coder/modules/code-server/run.sh +++ b/registry/coder/modules/code-server/run.sh @@ -16,7 +16,7 @@ fi function run_code_server() { echo "👷 Running code-server in the background..." echo "Check logs at ${LOG_PATH}!" - $CODE_SERVER "$EXTENSION_ARG" --auth none --port "${PORT}" --app-name "${APP_NAME}" ${EXTRA_ARGS} > "${LOG_PATH}" 2>&1 & + $CODE_SERVER "$EXTENSION_ARG" --auth none --port "${PORT}" --app-name "${APP_NAME}" ${ADDITIONAL_ARGS} > "${LOG_PATH}" 2>&1 & } # Check if the settings file exists...