diff --git a/registry/coder/modules/git-clone/README.md b/registry/coder/modules/git-clone/README.md index 94d2ddacd..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.2" + 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.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" base_dir = "~/projects/coder" @@ -43,11 +43,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 +70,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 +105,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,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.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://gitlab.com/coder/coder/-/tree/feat/example" } @@ -134,13 +137,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,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.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" branch_name = "feat/example" @@ -173,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.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" folder_name = "coder-dev" @@ -191,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 @@ -208,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.2" + version = "1.2.3" agent_id = coder_agent.example.id url = "https://github.com/coder/coder" post_clone_script = <<-EOT diff --git a/registry/coder/modules/git-clone/run.sh b/registry/coder/modules/git-clone/run.sh index 4b91ee687..c088e4d00 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) + 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