Skip to content

Commit 6ec506e

Browse files
fix(dotfiles): allow tilde (~) in git repository URLs (#763)
## Description The URL validation regex in the dotfiles module was rejecting URLs containing tilde (`~`) characters, which are commonly used in Bitbucket Server for user repositories (e.g. `ssh://git@bitbucket.example.org:7999/~username/repo.git`). This adds `~` to the allowed character set in all three validation regexes (for `default_dotfiles_uri`, `dotfiles_uri`, and the `coder_parameter` validation). ## Type of Change - [ ] New module - [ ] New template - [x] Bug fix - [ ] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information **Path:** `registry/coder/modules/dotfiles` **New version:** `v1.3.1` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun fmt`) - [ ] Changes tested locally ## Related Issues Fixes #762 Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
1 parent b794b1e commit 6ec506e

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

registry/coder/modules/dotfiles/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/
1818
module "dotfiles" {
1919
count = data.coder_workspace.me.start_count
2020
source = "registry.coder.com/coder/dotfiles/coder"
21-
version = "1.3.0"
21+
version = "1.3.1"
2222
agent_id = coder_agent.example.id
2323
}
2424
```
@@ -31,7 +31,7 @@ module "dotfiles" {
3131
module "dotfiles" {
3232
count = data.coder_workspace.me.start_count
3333
source = "registry.coder.com/coder/dotfiles/coder"
34-
version = "1.3.0"
34+
version = "1.3.1"
3535
agent_id = coder_agent.example.id
3636
}
3737
```
@@ -42,7 +42,7 @@ module "dotfiles" {
4242
module "dotfiles" {
4343
count = data.coder_workspace.me.start_count
4444
source = "registry.coder.com/coder/dotfiles/coder"
45-
version = "1.3.0"
45+
version = "1.3.1"
4646
agent_id = coder_agent.example.id
4747
user = "root"
4848
}
@@ -54,14 +54,14 @@ module "dotfiles" {
5454
module "dotfiles" {
5555
count = data.coder_workspace.me.start_count
5656
source = "registry.coder.com/coder/dotfiles/coder"
57-
version = "1.3.0"
57+
version = "1.3.1"
5858
agent_id = coder_agent.example.id
5959
}
6060
6161
module "dotfiles-root" {
6262
count = data.coder_workspace.me.start_count
6363
source = "registry.coder.com/coder/dotfiles/coder"
64-
version = "1.3.0"
64+
version = "1.3.1"
6565
agent_id = coder_agent.example.id
6666
user = "root"
6767
dotfiles_uri = module.dotfiles.dotfiles_uri
@@ -76,7 +76,7 @@ You can set a default dotfiles repository for all users by setting the `default_
7676
module "dotfiles" {
7777
count = data.coder_workspace.me.start_count
7878
source = "registry.coder.com/coder/dotfiles/coder"
79-
version = "1.3.0"
79+
version = "1.3.1"
8080
agent_id = coder_agent.example.id
8181
default_dotfiles_uri = "https://github.com/coder/dotfiles"
8282
}

registry/coder/modules/dotfiles/main.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe("dotfiles", async () => {
2626
"git@github.com:coder/dotfiles.git",
2727
"git://github.com/coder/dotfiles.git",
2828
"ssh://git@github.com/coder/dotfiles.git",
29+
"ssh://git@bitbucket.example.org:7999/~myusername/dotfiles.git",
2930
];
3031
for (const url of validUrls) {
3132
const state = await runTerraformApply(import.meta.dir, {

registry/coder/modules/dotfiles/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ variable "default_dotfiles_uri" {
4040
validation {
4141
condition = (
4242
var.default_dotfiles_uri == "" ||
43-
can(regex("^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@-]+$", var.default_dotfiles_uri))
43+
can(regex("^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@~-]+$", var.default_dotfiles_uri))
4444
)
4545
error_message = "Must be a valid dotfiles repository URL (https, git@, or git://) without special characters."
4646
}
@@ -55,7 +55,7 @@ variable "dotfiles_uri" {
5555
condition = (
5656
var.dotfiles_uri == null ||
5757
var.dotfiles_uri == "" ||
58-
can(regex("^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@-]+$", var.dotfiles_uri))
58+
can(regex("^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@~-]+$", var.dotfiles_uri))
5959
)
6060
error_message = "Must be a valid dotfiles repository URL (https, git@, or git://) without special characters."
6161
}
@@ -102,7 +102,7 @@ data "coder_parameter" "dotfiles_uri" {
102102
icon = "/icon/dotfiles.svg"
103103

104104
validation {
105-
regex = "^$|^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@-]+$"
105+
regex = "^$|^(https?://|ssh://|git@|git://)[a-zA-Z0-9._/:@~-]+$"
106106
error = "Must be a valid dotfiles repository URL (https, git@, or git://) without special characters."
107107
}
108108
}

0 commit comments

Comments
 (0)