Skip to content

Commit 091cd57

Browse files
Merge branch 'main' into fix-codex-2-2-0
2 parents ab5daad + e7d705b commit 091cd57

File tree

17 files changed

+626
-64
lines changed

17 files changed

+626
-64
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
Closes #
2-
31
## Description
42

53
<!-- Briefly describe what this PR does and why -->
64

75
## Type of Change
86

97
- [ ] New module
8+
- [ ] New template
109
- [ ] Bug fix
1110
- [ ] Feature/enhancement
1211
- [ ] Documentation
@@ -20,10 +19,16 @@ Closes #
2019
**New version:** `v1.0.0`
2120
**Breaking change:** [ ] Yes [ ] No
2221

22+
## Template Information
23+
24+
<!-- Delete this section if not applicable -->
25+
26+
**Path:** `registry/[namespace]/templates/[template-name]`
27+
2328
## Testing & Validation
2429

2530
- [ ] Tests pass (`bun test`)
26-
- [ ] Code formatted (`bun run fmt`)
31+
- [ ] Code formatted (`bun fmt`)
2732
- [ ] Changes tested locally
2833

2934
## Related Issues

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
run: bun install
2929
- name: Run TypeScript tests
3030
run: bun test
31+
- name: Run Terraform tests
32+
run: ./scripts/terraform_test_all.sh
3133
- name: Run Terraform Validate
3234
run: bun terraform-validate
3335
validate-style:

.icons/auto-dev-server.svg

Lines changed: 4 additions & 0 deletions
Loading

.icons/nexus-repository.svg

Lines changed: 5 additions & 0 deletions
Loading

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,23 @@ This script generates:
124124
- Accurate description and usage examples
125125
- Correct icon path (usually `../../../../.icons/your-icon.svg`)
126126
- Proper tags that describe your module
127-
3. **Create at least one `.tftest.hcl`** to test your module with `terraform test`
127+
3. **Create tests for your module:**
128+
- **Terraform tests**: Create a `*.tftest.hcl` file and test with `terraform test`
129+
- **TypeScript tests**: Create `main.test.ts` file if your module runs scripts or has business logic that Terraform tests can't cover
128130
4. **Add any scripts** or additional files your module needs
129131

130132
### 4. Test and Submit
131133

132134
```bash
133-
# Test your module (from the module directory)
135+
# Test your module
136+
cd registry/[namespace]/modules/[module-name]
137+
138+
# Required: Test Terraform functionality
134139
terraform init -upgrade
135140
terraform test -verbose
136141

137-
# Or run all tests in the repo
138-
./scripts/terraform_test_all.sh
142+
# Optional: Test TypeScript files if you have main.test.ts
143+
bun test main.test.ts
139144

140145
# Format code
141146
bun run fmt
@@ -343,8 +348,8 @@ coder templates push test-[template-name] -d .
343348
terraform init -upgrade
344349
terraform test -verbose
345350

346-
# Test all modules
347-
./scripts/terraform_test_all.sh
351+
# Optional: If you have TypeScript tests
352+
bun test main.test.ts
348353
```
349354

350355
### 3. Maintain Backward Compatibility
@@ -393,7 +398,9 @@ Example: `https://github.com/coder/registry/compare/main...your-branch?template=
393398
### Every Module Must Have
394399

395400
- `main.tf` - Terraform code
396-
- One or more `.tftest.hcl` files - Working tests with `terraform test`
401+
- **Tests**:
402+
- `*.tftest.hcl` files with `terraform test` (to test terraform specific logic)
403+
- `main.test.ts` file with `bun test` (to test business logic, i.e., `coder_script` to install a package.)
397404
- `README.md` - Documentation with frontmatter
398405

399406
### Every Template Must Have
@@ -493,7 +500,7 @@ When reporting bugs, include:
493500
2. **No tests** or broken tests
494501
3. **Hardcoded values** instead of variables
495502
4. **Breaking changes** without defaults
496-
5. **Not running** formatting (`bun run fmt`) and tests (`terraform test`) before submitting
503+
5. **Not running** formatting (`bun run fmt`) and tests (`terraform test`, and `bun test main.test.ts` if applicable) before submitting
497504

498505
## For Maintainers
499506

examples/modules/MODULE_NAME.tftest.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ run "app_url_uses_port" {
1515
}
1616

1717
assert {
18-
condition = resource.coder_app.MODULE_NAME.url == "http://localhost:19999"
19-
error_message = "Expected MODULE_NAME app URL to include configured port"
18+
condition = resource.coder_app.module_name.url == "http://localhost:19999"
19+
error_message = "Expected module-name app URL to include configured port"
2020
}
2121
}

examples/modules/main.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ variable "agent_id" {
3535

3636
variable "log_path" {
3737
type = string
38-
description = "The path to log MODULE_NAME to."
39-
default = "/tmp/MODULE_NAME.log"
38+
description = "The path to the module log file."
39+
default = "/tmp/module_name.log"
4040
}
4141

4242
variable "port" {
4343
type = number
44-
description = "The port to run MODULE_NAME on."
44+
description = "The port to run the application on."
4545
default = 19999
4646
}
4747

@@ -59,9 +59,9 @@ variable "order" {
5959
# Add other variables here
6060

6161

62-
resource "coder_script" "MODULE_NAME" {
62+
resource "coder_script" "module_name" {
6363
agent_id = var.agent_id
64-
display_name = "MODULE_NAME"
64+
display_name = "Module Name"
6565
icon = local.icon_url
6666
script = templatefile("${path.module}/run.sh", {
6767
LOG_PATH : var.log_path,
@@ -70,10 +70,10 @@ resource "coder_script" "MODULE_NAME" {
7070
run_on_stop = false
7171
}
7272

73-
resource "coder_app" "MODULE_NAME" {
73+
resource "coder_app" "module_name" {
7474
agent_id = var.agent_id
75-
slug = "MODULE_NAME"
76-
display_name = "MODULE_NAME"
75+
slug = "module-name"
76+
display_name = "Module Name"
7777
url = "http://localhost:${var.port}"
7878
icon = local.icon_url
7979
subdomain = false
@@ -88,10 +88,10 @@ resource "coder_app" "MODULE_NAME" {
8888
}
8989
}
9090

91-
data "coder_parameter" "MODULE_NAME" {
92-
type = "list(string)"
93-
name = "MODULE_NAME"
94-
display_name = "MODULE_NAME"
91+
data "coder_parameter" "module_name" {
92+
type = "string"
93+
name = "module_name"
94+
display_name = "Module Name"
9595
icon = local.icon_url
9696
mutable = var.mutable
9797
default = local.options["Option 1"]["value"]

registry/coder/modules/kasmvnc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Automatically install [KasmVNC](https://kasmweb.com/kasmvnc) in a workspace, and
1414
module "kasmvnc" {
1515
count = data.coder_workspace.me.start_count
1616
source = "registry.coder.com/coder/kasmvnc/coder"
17-
version = "1.2.3"
17+
version = "1.2.4"
1818
agent_id = coder_agent.example.id
1919
desktop_environment = "xfce"
2020
subdomain = true

registry/coder/modules/kasmvnc/run.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ install_deb() {
6060
sudo apt-get -o DPkg::Lock::Timeout=300 -qq update
6161
fi
6262

63+
echo "Installing required Perl DateTime module..."
64+
DEBIAN_FRONTEND=noninteractive sudo apt-get -o DPkg::Lock::Timeout=300 install --yes -qq --no-install-recommends --no-install-suggests libdatetime-perl
65+
6366
DEBIAN_FRONTEND=noninteractive sudo apt-get -o DPkg::Lock::Timeout=300 install --yes -qq --no-install-recommends --no-install-suggests "$kasmdeb"
6467
rm "$kasmdeb"
6568
}
@@ -233,19 +236,17 @@ get_http_dir() {
233236

234237
# Check the system configuration path
235238
if [[ -e /etc/kasmvnc/kasmvnc.yaml ]]; then
236-
d=($(grep -E "^\s*httpd_directory:.*$" /etc/kasmvnc/kasmvnc.yaml))
237-
# If this grep is successful, it will return:
238-
# httpd_directory: /usr/share/kasmvnc/www
239-
if [[ $${#d[@]} -eq 2 && -d "$${d[1]}" ]]; then
240-
httpd_directory="$${d[1]}"
239+
d=$(grep -E '^\s*httpd_directory:.*$' "/etc/kasmvnc/kasmvnc.yaml" | awk '{print $$2}')
240+
if [[ -n "$d" && -d "$d" ]]; then
241+
httpd_directory=$d
241242
fi
242243
fi
243244

244245
# Check the home directory for overriding values
245246
if [[ -e "$HOME/.vnc/kasmvnc.yaml" ]]; then
246-
d=($(grep -E "^\s*httpd_directory:.*$" "$HOME/.vnc/kasmvnc.yaml"))
247-
if [[ $${#d[@]} -eq 2 && -d "$${d[1]}" ]]; then
248-
httpd_directory="$${d[1]}"
247+
d=$(grep -E '^\s*httpd_directory:.*$' "$HOME/.vnc/kasmvnc.yaml" | awk '{print $$2}')
248+
if [[ -n "$d" && -d "$d" ]]; then
249+
httpd_directory=$d
249250
fi
250251
fi
251252
echo $httpd_directory

registry/coder/templates/kubernetes-devcontainer/main.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,14 @@ module "code-server" {
426426
# This ensures that the latest non-breaking version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
427427
version = "~> 1.0"
428428

429-
agent_id = coder_agent.main.id
430-
agent_name = "main"
431-
order = 1
429+
agent_id = coder_agent.main.id
430+
order = 1
432431
}
433432

434433
# See https://registry.coder.com/modules/coder/jetbrains
435434
module "jetbrains" {
436435
count = data.coder_workspace.me.start_count
437-
source = "registry.coder.com/modules/coder/jetbrains/coder"
436+
source = "registry.coder.com/coder/jetbrains/coder"
438437
version = "~> 1.0"
439438
agent_id = coder_agent.main.id
440439
agent_name = "main"

0 commit comments

Comments
 (0)