@@ -14,7 +14,7 @@ This module allows you to automatically clone a repository by URL and skip if it
1414module "git-clone" {
1515 count = data.coder_workspace.me.start_count
1616 source = "registry.coder.com/coder/git-clone/coder"
17- version = "1.2.3 "
17+ version = "1.3.0 "
1818 agent_id = coder_agent.example.id
1919 url = "https://github.com/coder/coder"
2020}
@@ -28,7 +28,7 @@ module "git-clone" {
2828module "git-clone" {
2929 count = data.coder_workspace.me.start_count
3030 source = "registry.coder.com/coder/git-clone/coder"
31- version = "1.2.3 "
31+ version = "1.3.0 "
3232 agent_id = coder_agent.example.id
3333 url = "https://github.com/coder/coder"
3434 base_dir = "~/projects/coder"
@@ -43,7 +43,7 @@ To use with [Git Authentication](https://coder.com/docs/v2/latest/admin/git-prov
4343module "git-clone" {
4444 count = data.coder_workspace.me.start_count
4545 source = "registry.coder.com/coder/git-clone/coder"
46- version = "1.2.3 "
46+ version = "1.3.0 "
4747 agent_id = coder_agent.example.id
4848 url = "https://github.com/coder/coder"
4949}
@@ -70,7 +70,7 @@ data "coder_parameter" "git_repo" {
7070module "git_clone" {
7171 count = data.coder_workspace.me.start_count
7272 source = "registry.coder.com/coder/git-clone/coder"
73- version = "1.2.3 "
73+ version = "1.3.0 "
7474 agent_id = coder_agent.example.id
7575 url = data.coder_parameter.git_repo.value
7676}
@@ -105,7 +105,7 @@ Configuring `git-clone` for a self-hosted GitHub Enterprise Server running at `g
105105module "git-clone" {
106106 count = data.coder_workspace.me.start_count
107107 source = "registry.coder.com/coder/git-clone/coder"
108- version = "1.2.3 "
108+ version = "1.3.0 "
109109 agent_id = coder_agent.example.id
110110 url = "https://github.example.com/coder/coder/tree/feat/example"
111111 git_providers = {
@@ -125,7 +125,7 @@ To GitLab clone with a specific branch like `feat/example`
125125module "git-clone" {
126126 count = data.coder_workspace.me.start_count
127127 source = "registry.coder.com/coder/git-clone/coder"
128- version = "1.2.3 "
128+ version = "1.3.0 "
129129 agent_id = coder_agent.example.id
130130 url = "https://gitlab.com/coder/coder/-/tree/feat/example"
131131}
@@ -137,7 +137,7 @@ Configuring `git-clone` for a self-hosted GitLab running at `gitlab.example.com`
137137module "git-clone" {
138138 count = data.coder_workspace.me.start_count
139139 source = "registry.coder.com/coder/git-clone/coder"
140- version = "1.2.3 "
140+ version = "1.3.0 "
141141 agent_id = coder_agent.example.id
142142 url = "https://gitlab.example.com/coder/coder/-/tree/feat/example"
143143 git_providers = {
@@ -159,7 +159,7 @@ For example, to clone the `feat/example` branch:
159159module "git-clone" {
160160 count = data.coder_workspace.me.start_count
161161 source = "registry.coder.com/coder/git-clone/coder"
162- version = "1.2.3 "
162+ version = "1.3.0 "
163163 agent_id = coder_agent.example.id
164164 url = "https://github.com/coder/coder"
165165 branch_name = "feat/example"
@@ -177,7 +177,7 @@ For example, this will clone into the `~/projects/coder/coder-dev` folder:
177177module "git-clone" {
178178 count = data.coder_workspace.me.start_count
179179 source = "registry.coder.com/coder/git-clone/coder"
180- version = "1.2.3 "
180+ version = "1.3.0 "
181181 agent_id = coder_agent.example.id
182182 url = "https://github.com/coder/coder"
183183 folder_name = "coder-dev"
@@ -196,13 +196,36 @@ If not defined, the default, `0`, performs a full clone.
196196module "git-clone" {
197197 count = data.coder_workspace.me.start_count
198198 source = "registry.coder.com/coder/git-clone/coder"
199- version = "1.2.3 "
199+ version = "1.3.0 "
200200 agent_id = coder_agent.example.id
201201 url = "https://github.com/coder/coder"
202202 depth = 1
203203}
204204```
205205
206+ ## Pre-clone script
207+
208+ Run a custom script before cloning the repository by setting the ` pre_clone_script ` variable.
209+ This is useful for preparing the environment or validating prerequisites before cloning.
210+
211+ ``` tf
212+ module "git-clone" {
213+ count = data.coder_workspace.me.start_count
214+ source = "registry.coder.com/coder/git-clone/coder"
215+ version = "1.3.0"
216+ agent_id = coder_agent.example.id
217+ url = "https://github.com/coder/coder"
218+ pre_clone_script = <<-EOT
219+ #!/bin/bash
220+ echo "Preparing to clone repository..."
221+ # Check prerequisites
222+ command -v npm >/dev/null 2>&1 || { echo "npm is required but not installed."; exit 1; }
223+ # Set up environment
224+ export NODE_ENV=development
225+ EOT
226+ }
227+ ```
228+
206229## Post-clone script
207230
208231Run a custom script after cloning the repository by setting the ` post_clone_script ` variable.
@@ -212,7 +235,7 @@ This is useful for running initialization tasks like installing dependencies or
212235module "git-clone" {
213236 count = data.coder_workspace.me.start_count
214237 source = "registry.coder.com/coder/git-clone/coder"
215- version = "1.2.3 "
238+ version = "1.3.0 "
216239 agent_id = coder_agent.example.id
217240 url = "https://github.com/coder/coder"
218241 post_clone_script = <<-EOT
0 commit comments