From 13e3bcbebd1b0ea93f0fe915122e3f8e66f58c5a Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 06:48:53 +0000 Subject: [PATCH 1/7] fix(git-clone): use unique temp file for post_clone_script to avoid race condition --- registry/coder/modules/git-clone/run.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/registry/coder/modules/git-clone/run.sh b/registry/coder/modules/git-clone/run.sh index 4b91ee687..fe59e91e6 100644 --- a/registry/coder/modules/git-clone/run.sh +++ b/registry/coder/modules/git-clone/run.sh @@ -58,9 +58,10 @@ fi # Run post-clone script if provided if [ -n "$POST_CLONE_SCRIPT" ]; then echo "Running post-clone script..." - echo "$POST_CLONE_SCRIPT" | base64 -d > /tmp/post_clone.sh - chmod +x /tmp/post_clone.sh + POST_CLONE_TMP=$(mktemp /tmp/post_clone_XXXXXX.sh) + echo "$POST_CLONE_SCRIPT" | base64 -d > "$POST_CLONE_TMP" + chmod +x "$POST_CLONE_TMP" cd "$CLONE_PATH" || exit - /tmp/post_clone.sh - rm /tmp/post_clone.sh + "$POST_CLONE_TMP" + rm "$POST_CLONE_TMP" fi From 32d274796f2048d32c96748c56ca396d2965128a Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 07:21:59 +0000 Subject: [PATCH 2/7] fix: remove quotes from script execution to match original behavior --- registry/coder/modules/git-clone/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/git-clone/run.sh b/registry/coder/modules/git-clone/run.sh index fe59e91e6..4c1638ae7 100644 --- a/registry/coder/modules/git-clone/run.sh +++ b/registry/coder/modules/git-clone/run.sh @@ -62,6 +62,6 @@ if [ -n "$POST_CLONE_SCRIPT" ]; then echo "$POST_CLONE_SCRIPT" | base64 -d > "$POST_CLONE_TMP" chmod +x "$POST_CLONE_TMP" cd "$CLONE_PATH" || exit - "$POST_CLONE_TMP" + $POST_CLONE_TMP rm "$POST_CLONE_TMP" fi From ce2db9cb2d02823e6789d467c39efa3c704a2b1c Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 07:24:40 +0000 Subject: [PATCH 3/7] fix: use mktemp without template for BusyBox compatibility --- registry/coder/modules/git-clone/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/git-clone/run.sh b/registry/coder/modules/git-clone/run.sh index 4c1638ae7..c088e4d00 100644 --- a/registry/coder/modules/git-clone/run.sh +++ b/registry/coder/modules/git-clone/run.sh @@ -58,7 +58,7 @@ fi # Run post-clone script if provided if [ -n "$POST_CLONE_SCRIPT" ]; then echo "Running post-clone script..." - POST_CLONE_TMP=$(mktemp /tmp/post_clone_XXXXXX.sh) + POST_CLONE_TMP=$(mktemp) echo "$POST_CLONE_SCRIPT" | base64 -d > "$POST_CLONE_TMP" chmod +x "$POST_CLONE_TMP" cd "$CLONE_PATH" || exit From 2f5519af1ad190c420a71b9a90f681b3e98326f7 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 10:48:50 +0000 Subject: [PATCH 4/7] chore: bump git-clone module version to v1.2.3 --- registry/coder/modules/git-clone/README.md | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index 94d2ddacd..2a8367b6a 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -14,10 +14,11 @@ This module allows you to automatically clone a repository by URL and skip if it module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } + ``` ## Examples @@ -28,11 +29,12 @@ module "git-clone" { module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" base_dir = "~/projects/coder" } + ``` ### Git Authentication @@ -43,11 +45,12 @@ To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-prov module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } + data "coder_external_auth" "github" { id = "github" } @@ -69,11 +72,12 @@ data "coder_parameter" "git_repo" { module "git_clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = data.coder_parameter.git_repo.value } + # Create a code-server instance for the cloned repository module "code-server" { count = data.coder_workspace.me.start_count @@ -103,13 +107,14 @@ Configuring `git-clone` for a self-hosted GitHub Enterprise Server running at `g module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.example.com/coder/coder/tree/feat/example" git_providers = { "https://github.example.com/" = { provider = "github" } + } } ``` @@ -122,10 +127,11 @@ To GitLab clone with a specific branch like `feat/example` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } + ``` Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` @@ -134,13 +140,14 @@ Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://gitlab.example.com/coder/coder/-/tree/feat/example" git_providers = { "https://gitlab.example.com/" = { provider = "gitlab" } + } } ``` @@ -155,11 +162,12 @@ For example, to clone the `feat/example` branch: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" branch_name = "feat/example" } + ``` ## Git clone with different destination folder @@ -173,12 +181,13 @@ For example, this will clone into the `~/projects/coder/coder-dev` folder: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" folder_name = "coder-dev" base_dir = "~/projects/coder" } + ``` ## Git shallow clone @@ -208,7 +217,7 @@ This is useful for running initialization tasks like installing dependencies or module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" post_clone_script = <<-EOT @@ -220,4 +229,5 @@ module "git-clone" { make setup EOT } + ``` From c5dd57ca55e942e1354b510b3ad958050ead2b65 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 10:50:18 +0000 Subject: [PATCH 5/7] chore: fix README formatting --- registry/coder/modules/git-clone/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index 2a8367b6a..b10b92d07 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -18,7 +18,6 @@ module "git-clone" { agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } - ``` ## Examples @@ -34,7 +33,6 @@ module "git-clone" { url = "https://github.com/coder/coder" base_dir = "~/projects/coder" } - ``` ### Git Authentication @@ -131,7 +129,6 @@ module "git-clone" { agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } - ``` Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` @@ -167,7 +164,6 @@ module "git-clone" { url = "https://github.com/coder/coder" branch_name = "feat/example" } - ``` ## Git clone with different destination folder @@ -187,7 +183,6 @@ module "git-clone" { folder_name = "coder-dev" base_dir = "~/projects/coder" } - ``` ## Git shallow clone @@ -229,5 +224,4 @@ module "git-clone" { make setup EOT } - ``` From 82bc9525b05ecba2d3ab57922dd89201f2bbaea0 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 10:53:46 +0000 Subject: [PATCH 6/7] fix: correct version and source path in shallow clone example --- registry/coder/modules/git-clone/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index b10b92d07..e33bdb410 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -195,8 +195,8 @@ If not defined, the default, `0`, performs a full clone. ```tf module "git-clone" { count = data.coder_workspace.me.start_count - source = "registry.coder.com/modules/git-clone/coder" - version = "1.2.2" + source = "registry.coder.com/coder/git-clone/coder" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" depth = 1 From b6204b6d598d6c14e3d4a56874f745c97cf126f1 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Sat, 13 Dec 2025 10:56:31 +0000 Subject: [PATCH 7/7] chore: fix prettier formatting for version alignment --- registry/coder/modules/git-clone/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index e33bdb410..b4f2a75c6 100644 --- a/registry/coder/modules/git-clone/README.md +++ b/registry/coder/modules/git-clone/README.md @@ -14,7 +14,7 @@ This module allows you to automatically clone a repository by URL and skip if it module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -28,7 +28,7 @@ module "git-clone" { module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" base_dir = "~/projects/coder" @@ -43,7 +43,7 @@ To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-prov module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" } @@ -70,7 +70,7 @@ data "coder_parameter" "git_repo" { module "git_clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = data.coder_parameter.git_repo.value } @@ -105,7 +105,7 @@ Configuring `git-clone` for a self-hosted GitHub Enterprise Server running at `g module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.example.com/coder/coder/tree/feat/example" git_providers = { @@ -125,7 +125,7 @@ To GitLab clone with a specific branch like `feat/example` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } @@ -137,7 +137,7 @@ Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com` module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://gitlab.example.com/coder/coder/-/tree/feat/example" git_providers = { @@ -159,7 +159,7 @@ For example, to clone the `feat/example` branch: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" branch_name = "feat/example" @@ -177,7 +177,7 @@ For example, this will clone into the `~/projects/coder/coder-dev` folder: module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" folder_name = "coder-dev" @@ -212,7 +212,7 @@ This is useful for running initialization tasks like installing dependencies or module "git-clone" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "1.2.3" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" post_clone_script = <<-EOT