Skip to content

Commit d311164

Browse files
authored
Merge branch 'main' into feat/zizmor
2 parents 8cffde0 + ec57cb5 commit d311164

File tree

13 files changed

+250
-217
lines changed

13 files changed

+250
-217
lines changed

.github/workflows/check_registry_site_health.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v6
14+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1515

1616
- name: Run check.sh
1717
run: |

.github/workflows/ci.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Check out code
15-
uses: actions/checkout@v6
15+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1616
- name: Detect changed files
17-
uses: dorny/paths-filter@v3
17+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
1818
id: filter
1919
with:
2020
list-files: shell
@@ -37,9 +37,9 @@ jobs:
3737
all:
3838
- '**'
3939
- name: Set up Terraform
40-
uses: coder/coder/.github/actions/setup-tf@main
40+
uses: coder/coder/.github/actions/setup-tf@59cdd7e21f4d7da12567c0c29964d298fbf38f27 # v2.29.1
4141
- name: Set up Bun
42-
uses: oven-sh/setup-bun@v2
42+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
4343
with:
4444
# We're using the latest version of Bun for now, but it might be worth
4545
# reconsidering. They've pushed breaking changes in patch releases
@@ -80,20 +80,20 @@ jobs:
8080
runs-on: ubuntu-latest
8181
steps:
8282
- name: Check out code
83-
uses: actions/checkout@v6
83+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
8484
- name: Install Bun
85-
uses: oven-sh/setup-bun@v2
85+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
8686
with:
8787
bun-version: latest
8888
# Need Terraform for its formatter
8989
- name: Install Terraform
90-
uses: coder/coder/.github/actions/setup-tf@main
90+
uses: coder/coder/.github/actions/setup-tf@59cdd7e21f4d7da12567c0c29964d298fbf38f27 # v2.29.1
9191
- name: Install dependencies
9292
run: bun install
9393
- name: Validate formatting
9494
run: bun fmt:ci
9595
- name: Check for typos
96-
uses: crate-ci/[email protected]
96+
uses: crate-ci/typos@bb4666ad77b539a6b4ce4eda7ebb6de553704021 # v1.42.0
9797
with:
9898
config: .github/typos.toml
9999
validate-readme-files:
@@ -104,9 +104,9 @@ jobs:
104104
needs: validate-style
105105
steps:
106106
- name: Check out code
107-
uses: actions/checkout@v6
107+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
108108
- name: Set up Go
109-
uses: actions/setup-go@v6
109+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
110110
with:
111111
go-version: "1.24.0"
112112
- name: Validate contributors

.github/workflows/deploy-registry.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Checkout code
31-
uses: actions/checkout@v6
31+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3232
- name: Authenticate with Google Cloud
3333
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
3434
with:

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
name: lint
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v6
18-
- uses: actions/setup-go@v6
17+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
18+
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
1919
with:
2020
go-version: stable
2121
- name: golangci-lint
22-
uses: golangci/golangci-lint-action@v9
22+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
2323
with:
2424
version: v2.1

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v6
17+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1818
with:
1919
fetch-depth: 0
2020
persist-credentials: false
@@ -89,9 +89,9 @@ jobs:
8989
9090
for sha in $MODULE_COMMIT_SHAS; do
9191
SHORT_SHA=${sha:0:7}
92-
92+
9393
COMMIT_LINES=$(echo "$FULL_CHANGELOG" | grep -E "$SHORT_SHA|$(git log --format='%s' -n 1 $sha)" || true)
94-
94+
9595
if [ -n "$COMMIT_LINES" ]; then
9696
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}${COMMIT_LINES}\n"
9797
else

.github/workflows/version-bump.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,28 @@ jobs:
2020
issues: write
2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v6
23+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2424
with:
2525
fetch-depth: 0
2626
token: ${{ secrets.GITHUB_TOKEN }}
2727

2828
- name: Set up Bun
29-
uses: oven-sh/setup-bun@v2
29+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2
3030
with:
3131
bun-version: latest
3232

3333
- name: Set up Terraform
34-
uses: coder/coder/.github/actions/setup-tf@main
34+
uses: coder/coder/.github/actions/setup-tf@59cdd7e21f4d7da12567c0c29964d298fbf38f27 # v2.29.1
3535

3636
- name: Install dependencies
3737
run: bun install
3838

3939
- name: Extract bump type from label
40+
env:
41+
LABEL_NAME: ${{ github.event.label.name }}
4042
id: bump-type
4143
run: |
42-
case "${{ github.event.label.name }}" in
44+
case "$LABEL_NAME" in in
4345
"version:patch")
4446
echo "type=patch" >> $GITHUB_OUTPUT
4547
;;
@@ -50,7 +52,7 @@ jobs:
5052
echo "type=major" >> $GITHUB_OUTPUT
5153
;;
5254
*)
53-
echo "Invalid version label: ${{ github.event.label.name }}"
55+
echo "Invalid version label: ${LABEL_NAME}"
5456
exit 1
5557
;;
5658
esac
@@ -60,7 +62,7 @@ jobs:
6062

6163
- name: Comment on PR - Version bump required
6264
if: failure()
63-
uses: actions/github-script@v8
65+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
6466
with:
6567
github-token: ${{ secrets.GITHUB_TOKEN }}
6668
script: |

AGENTS.md

Lines changed: 29 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,168 +1,41 @@
11
# AGENTS.md
22

3-
This file provides guidance to AI coding assistants when working with code in this repository.
3+
Coder Registry: Terraform modules/templates for Coder workspaces under `registry/[namespace]/modules/` and `registry/[namespace]/templates/`.
44

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
5+
## Commands
166

177
```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-
---
8+
bun run fmt # Format code (Prettier + Terraform) - run before commits
9+
bun run tftest # Run all Terraform tests
10+
bun run tstest # Run all TypeScript tests
11+
terraform init -upgrade && terraform test -verbose # Test single module (run from module dir)
12+
bun test main.test.ts # Run single TS test (from module dir)
13+
./scripts/terraform_validate.sh # Validate Terraform syntax
14+
./scripts/new_module.sh ns/name # Create new module scaffold
15+
.github/scripts/version-bump.sh patch | minor | major # Bump module version after changes
9216
```
9317

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
18+
## Structure
15019

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
20+
- **Modules**: `registry/[ns]/modules/[name]/` with `main.tf`, `README.md` (YAML frontmatter), `.tftest.hcl` (required)
21+
- **Templates**: `registry/[ns]/templates/[name]/` with `main.tf`, `README.md`
22+
- **Validation**: `cmd/readmevalidation/` (Go) validates structure/frontmatter; URLs must be relative, not absolute
15623

157-
### Testing Workflow
24+
## Code Style
15825

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
26+
- Every module MUST have `.tftest.hcl` tests; optional `main.test.ts` for container/script tests
27+
- README frontmatter: `display_name`, `description`, `icon`, `verified: false`, `tags`
28+
- Use semantic versioning; bump version via script when modifying modules
29+
- Docker tests require Linux or Colima/OrbStack (not Docker Desktop)
30+
- Use `tf` (not `hcl`) for code blocks in README; use relative icon paths (e.g., `../../../../.icons/`)
16331

164-
### Namespace Management
32+
## PR Review Checklist
16533

166-
- Each contributor gets unique namespace
167-
- Namespace avatar required (avatar.png/svg in .images/)
168-
- Namespace README with contributor info and frontmatter
34+
- Version bumped via `.github/scripts/version-bump.sh` if module changed (patch=bugfix, minor=feature, major=breaking)
35+
- Breaking changes documented: removed inputs, changed defaults, new required variables
36+
- New variables have sensible defaults to maintain backward compatibility
37+
- Tests pass (`bun run tftest`, `bun run tstest`); add diagnostic logging for test failures
38+
- README examples updated with new version number; tooltip/behavior changes noted
39+
- Shell scripts handle errors gracefully (use `|| echo "Warning..."` for non-fatal failures)
40+
- No hardcoded values that should be configurable; no absolute URLs (use relative paths)
41+
- If AI-assisted: include model and tool/agent name at footer of PR body (e.g., "Generated with [Amp](thread-url) using Claude")

0 commit comments

Comments
 (0)