Skip to content

Commit 6dbc39d

Browse files
authored
Merge branch 'main' into brymut/add-hetzner-template
2 parents 992f770 + bc383a3 commit 6dbc39d

File tree

69 files changed

+1189
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1189
-542
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../AGENTS.md

.github/scripts/version-bump.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ main() {
192192

193193
# Always run formatter to ensure consistent formatting
194194
echo "🔧 Running formatter to ensure consistent formatting..."
195-
if command -v bun >/dev/null 2>&1; then
196-
bun fmt >/dev/null 2>&1 || echo "⚠️ Warning: bun fmt failed, but continuing..."
195+
if command -v bun > /dev/null 2>&1; then
196+
bun fmt > /dev/null 2>&1 || echo "⚠️ Warning: bun fmt failed, but continuing..."
197197
else
198198
echo "⚠️ Warning: bun not found, skipping formatting"
199199
fi

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- name: golangci-lint
2222
uses: golangci/golangci-lint-action@v8
2323
with:
24-
version: v2.1
24+
version: v2.1

.github/workflows/release.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ jobs:
1111
permissions:
1212
contents: write
1313
pull-requests: read
14-
14+
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v5
1818
with:
1919
fetch-depth: 0
2020
persist-credentials: false
21-
21+
2222
- name: Extract tag information
2323
id: tag_info
2424
run: |
2525
TAG=${GITHUB_REF#refs/tags/}
2626
echo "tag=$TAG" >> $GITHUB_OUTPUT
27-
27+
2828
IFS='/' read -ra PARTS <<< "$TAG"
2929
NAMESPACE="${PARTS[1]}"
3030
MODULE="${PARTS[2]}"
3131
VERSION="${PARTS[3]}"
32-
32+
3333
echo "namespace=$NAMESPACE" >> $GITHUB_OUTPUT
3434
echo "module=$MODULE" >> $GITHUB_OUTPUT
3535
echo "version=$VERSION" >> $GITHUB_OUTPUT
3636
echo "module_path=registry/$NAMESPACE/modules/$MODULE" >> $GITHUB_OUTPUT
37-
37+
3838
RELEASE_TITLE="$NAMESPACE/$MODULE $VERSION"
3939
echo "release_title=$RELEASE_TITLE" >> $GITHUB_OUTPUT
40-
40+
4141
- name: Find previous tag
4242
id: prev_tag
4343
env:
@@ -46,15 +46,15 @@ jobs:
4646
CURRENT_TAG: ${{ steps.tag_info.outputs.tag }}
4747
run: |
4848
PREV_TAG=$(git tag -l "release/$NAMESPACE/$MODULE/v*" | sort -V | grep -B1 "$CURRENT_TAG" | head -1)
49-
49+
5050
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "$CURRENT_TAG" ]; then
5151
echo "No previous tag found, using initial commit"
5252
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
5353
fi
54-
54+
5555
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
5656
echo "Previous tag: $PREV_TAG"
57-
57+
5858
- name: Generate changelog
5959
id: changelog
6060
env:
@@ -64,15 +64,15 @@ jobs:
6464
CURRENT_TAG: ${{ steps.tag_info.outputs.tag }}
6565
run: |
6666
echo "Generating changelog for $MODULE_PATH between $PREV_TAG and $CURRENT_TAG"
67-
67+
6868
COMMITS=$(git log --oneline --no-merges "$PREV_TAG..$CURRENT_TAG" -- "$MODULE_PATH")
69-
69+
7070
if [ -z "$COMMITS" ]; then
7171
echo "No commits found for this module"
7272
echo "changelog=No changes found for this module." >> $GITHUB_OUTPUT
7373
exit 0
7474
fi
75-
75+
7676
if [[ "$PREV_TAG" == release/* ]]; then
7777
FULL_CHANGELOG=$(gh api repos/:owner/:repo/releases/generate-notes \
7878
--field tag_name="$CURRENT_TAG" \
@@ -82,11 +82,11 @@ jobs:
8282
echo "New module detected, skipping GitHub API"
8383
FULL_CHANGELOG=""
8484
fi
85-
85+
8686
MODULE_COMMIT_SHAS=$(git log --format="%H" --no-merges "$PREV_TAG..$CURRENT_TAG" -- "$MODULE_PATH")
87-
87+
8888
FILTERED_CHANGELOG="## What's Changed\n\n"
89-
89+
9090
for sha in $MODULE_COMMIT_SHAS; do
9191
SHORT_SHA=${sha:0:7}
9292
@@ -100,11 +100,11 @@ jobs:
100100
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}* $COMMIT_MSG by @$AUTHOR\n"
101101
fi
102102
done
103-
103+
104104
echo "changelog<<EOF" >> $GITHUB_OUTPUT
105105
echo -e "$FILTERED_CHANGELOG" >> $GITHUB_OUTPUT
106106
echo "EOF" >> $GITHUB_OUTPUT
107-
107+
108108
- name: Create Release
109109
env:
110110
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -114,4 +114,4 @@ jobs:
114114
run: |
115115
gh release create "$TAG_NAME" \
116116
--title "$RELEASE_TITLE" \
117-
--notes "$CHANGELOG"
117+
--notes "$CHANGELOG"

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ linters:
163163
staticcheck:
164164
checks:
165165
- all
166-
- SA4006 # Detects redundant assignments
167-
- SA4009 # Detects redundant variable declarations
166+
- SA4006 # Detects redundant assignments
167+
- SA4009 # Detects redundant variable declarations
168168
- SA1019
169169
exclusions:
170170
generated: lax

.prettierignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Ignore symlinks to avoid Prettier errors
2+
CLAUDE.md
3+
.github/copilot-instructions.md
4+
5+
# Ignore node_modules and dependencies
6+
node_modules/
7+
8+
# Ignore Terraform files (formatted by terraform fmt)
9+
*.tf
10+
*.hcl
11+
*.tfvars
12+
13+
# Ignore generated and temporary files
14+
.terraform/
15+
*.tfstate
16+
*.tfstate.backup
17+
*.tfstate.lock.info
18+
19+
# Ignore other files that shouldn't be formatted
20+
bun.lock
21+
go.sum
22+
go.mod

AGENTS.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI coding assistants when working with code in this repository.
4+
5+
## Project Overview
6+
7+
The Coder Registry is a community-driven repository for Terraform modules and templates that extend Coder workspaces. It's organized with:
8+
9+
- **Modules**: Individual components and tools (IDEs, auth integrations, dev tools)
10+
- **Templates**: Complete workspace configurations for different platforms
11+
- **Namespaces**: Each contributor has their own namespace under `/registry/[namespace]/`
12+
13+
## Common Development Commands
14+
15+
### Formatting
16+
17+
```bash
18+
bun run fmt # Format all code (Prettier + Terraform)
19+
bun run fmt:ci # Check formatting (CI mode)
20+
```
21+
22+
### Testing
23+
24+
```bash
25+
# Test all modules with .tftest.hcl files
26+
bun run test
27+
28+
# Test specific module (from module directory)
29+
terraform init -upgrade
30+
terraform test -verbose
31+
32+
# Validate Terraform syntax
33+
./scripts/terraform_validate.sh
34+
```
35+
36+
### Module Creation
37+
38+
```bash
39+
# Generate new module scaffold
40+
./scripts/new_module.sh namespace/module-name
41+
```
42+
43+
### TypeScript Testing & Setup
44+
45+
The repository uses Bun for TypeScript testing with utilities:
46+
47+
- `test/test.ts` - Testing utilities for container management and Terraform operations
48+
- `setup.ts` - Test cleanup (removes .tfstate files and test containers)
49+
- Container-based testing with Docker for module validation
50+
51+
## Architecture & Organization
52+
53+
### Directory Structure
54+
55+
```
56+
registry/[namespace]/
57+
├── README.md # Contributor info with frontmatter
58+
├── .images/ # Namespace avatar (avatar.png/svg)
59+
├── modules/ # Individual components
60+
│ └── [module]/ # Each module has main.tf, README.md, tests
61+
└── templates/ # Complete workspace configs
62+
└── [template]/ # Each template has main.tf, README.md
63+
```
64+
65+
### Key Components
66+
67+
**Module Structure**: Each module contains:
68+
69+
- `main.tf` - Terraform implementation
70+
- `README.md` - Documentation with YAML frontmatter
71+
- `.tftest.hcl` - Terraform test files (required)
72+
- `run.sh` - Optional startup script
73+
74+
**Template Structure**: Each template contains:
75+
76+
- `main.tf` - Complete Coder template configuration
77+
- `README.md` - Documentation with YAML frontmatter
78+
- Additional configs, scripts as needed
79+
80+
### README Frontmatter Requirements
81+
82+
All modules/templates require YAML frontmatter:
83+
84+
```yaml
85+
---
86+
display_name: "Module Name"
87+
description: "Brief description"
88+
icon: "../../../../.icons/tool.svg"
89+
verified: false
90+
tags: ["tag1", "tag2"]
91+
---
92+
```
93+
94+
## Testing Requirements
95+
96+
### Module Testing
97+
98+
- Every module MUST have `.tftest.hcl` test files
99+
- Optional `main.test.ts` files for container-based testing or complex business logic validation
100+
- Tests use Docker containers with `--network=host` flag
101+
- Linux required for testing (Docker Desktop on macOS/Windows won't work)
102+
- Use Colima or OrbStack on macOS instead of Docker Desktop
103+
104+
### Test Utilities
105+
106+
The `test/test.ts` file provides:
107+
108+
- `runTerraformApply()` - Execute Terraform with variables
109+
- `executeScriptInContainer()` - Run coder_script resources in containers
110+
- `testRequiredVariables()` - Validate required variables
111+
- Container management functions
112+
113+
## Validation & Quality
114+
115+
### Automated Validation
116+
117+
The Go validation tool (`cmd/readmevalidation/`) checks:
118+
119+
- Repository structure integrity
120+
- Contributor README files
121+
- Module and template documentation
122+
- Frontmatter format compliance
123+
124+
### Versioning
125+
126+
Use semantic versioning for modules:
127+
128+
- **Patch** (1.2.3 → 1.2.4): Bug fixes
129+
- **Minor** (1.2.3 → 1.3.0): New features, adding inputs
130+
- **Major** (1.2.3 → 2.0.0): Breaking changes
131+
132+
## Dependencies & Tools
133+
134+
### Required Tools
135+
136+
- **Terraform** - Module development and testing
137+
- **Docker** - Container-based testing
138+
- **Bun** - JavaScript runtime for formatting/scripts
139+
- **Go 1.23+** - Validation tooling
140+
141+
### Development Dependencies
142+
143+
- Prettier with Terraform and shell plugins
144+
- TypeScript for test utilities
145+
- Various npm packages for documentation processing
146+
147+
## Workflow Notes
148+
149+
### Contributing Process
150+
151+
1. Create namespace (first-time contributors)
152+
2. Generate module/template files using scripts
153+
3. Implement functionality and tests
154+
4. Run formatting and validation
155+
5. Submit PR with appropriate template
156+
157+
### Testing Workflow
158+
159+
- All modules must pass `terraform test`
160+
- Use `bun run test` for comprehensive testing
161+
- Format code with `bun run fmt` before submission
162+
- Manual testing recommended for templates
163+
164+
### Namespace Management
165+
166+
- Each contributor gets unique namespace
167+
- Namespace avatar required (avatar.png/svg in .images/)
168+
- Namespace README with contributor info and frontmatter

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

bun.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"": {
55
"name": "registry",
66
"devDependencies": {
7-
"@types/bun": "^1.2.18",
8-
"bun-types": "^1.2.18",
7+
"@types/bun": "^1.2.21",
8+
"bun-types": "^1.2.21",
99
"dedent": "^1.6.0",
1010
"gray-matter": "^4.0.3",
11-
"marked": "^16.0.0",
11+
"marked": "^16.2.0",
1212
"prettier": "^3.6.2",
1313
"prettier-plugin-sh": "^0.18.0",
1414
"prettier-plugin-terraform-formatter": "^1.2.1",
@@ -21,15 +21,15 @@
2121
"packages": {
2222
"@reteps/dockerfmt": ["@reteps/[email protected]", "", {}, "sha512-Tb5wIMvBf/nLejTQ61krK644/CEMB/cpiaIFXqGApfGqO3GwcR3qnI0DbmkFVCl2OyEp8LnLX3EkucoL0+tbFg=="],
2323

24-
"@types/bun": ["@types/[email protected].18", "", { "dependencies": { "bun-types": "1.2.18" } }, "sha512-Xf6RaWVheyemaThV0kUfaAUvCNokFr+bH8Jxp+tTZfx7dAPA8z9ePnP9S9+Vspzuxxx9JRAXhnyccRj3GyCMdQ=="],
24+
"@types/bun": ["@types/[email protected].21", "", { "dependencies": { "bun-types": "1.2.21" } }, "sha512-NiDnvEqmbfQ6dmZ3EeUO577s4P5bf4HCTXtI6trMc6f6RzirY5IrF3aIookuSpyslFzrnvv2lmEWv5HyC1X79A=="],
2525

2626
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw=="],
2727

2828
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
2929

3030
"argparse": ["[email protected]", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
3131

32-
"bun-types": ["[email protected].18", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-04+Eha5NP7Z0A9YgDAzMk5PHR16ZuLVa83b26kH5+cp1qZW4F6FmAURngE7INf4tKOvCE69vYvDEwoNl1tGiWw=="],
32+
"bun-types": ["[email protected].21", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-sa2Tj77Ijc/NTLS0/Odjq/qngmEPZfbfnOERi0KRUYhT9R8M4VBioWVmMWE5GrYbKMc+5lVybXygLdibHaqVqw=="],
3333

3434
"csstype": ["[email protected]", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
3535

@@ -47,7 +47,7 @@
4747

4848
"kind-of": ["[email protected]", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="],
4949

50-
"marked": ["marked@16.0.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA=="],
50+
"marked": ["marked@16.2.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-LbbTuye+0dWRz2TS9KJ7wsnD4KAtpj0MVkWc90XvBa6AslXsT0hTBVH5k32pcSyHH1fst9XEFJunXHktVy0zlg=="],
5151

5252
"prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="],
5353

cmd/readmevalidation/codermodules.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ func validateCoderModuleReadme(rm coderResourceReadme) []error {
9494
for _, err := range validateCoderModuleReadmeBody(rm.body) {
9595
errs = append(errs, addFilePathToError(rm.filePath, err))
9696
}
97+
for _, err := range validateResourceGfmAlerts(rm.body) {
98+
errs = append(errs, addFilePathToError(rm.filePath, err))
99+
}
97100
if fmErrs := validateCoderResourceFrontmatter("modules", rm.filePath, rm.frontmatter); len(fmErrs) != 0 {
98101
errs = append(errs, fmErrs...)
99102
}

0 commit comments

Comments
 (0)