- Notifications
You must be signed in to change notification settings - Fork72
chore: update CONTRIBUTION docs to explain both tests, and update CI for both tests#384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes fromall commits
82d06f9
7469a6e
a7bad95
37cde45
2a78dc8
6a98f83
7cd4969
7f94259
af28c4f
d7e2892
276c61a
3920709
7cefd58
32f2e05
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -124,18 +124,23 @@ This script generates: | ||
- Accurate description and usage examples | ||
- Correct icon path (usually `../../../../.icons/your-icon.svg`) | ||
- Proper tags that describe your module | ||
3. **Create tests for your module:** | ||
- **Terraform tests**: Create a `*.tftest.hcl` file and test with `terraform test` | ||
- **TypeScript tests**: Create `main.test.ts` file if your module runs scripts or has business logic that Terraform tests can't cover | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
4. **Add any scripts** or additional files your module needs | ||
### 4. Test and Submit | ||
```bash | ||
# Test your module | ||
cd registry/[namespace]/modules/[module-name] | ||
# Required: Test Terraform functionality | ||
terraform init -upgrade | ||
terraform test -verbose | ||
#Optional: Test TypeScript files if you have main.test.ts | ||
bun test main.test.ts | ||
# Format code | ||
bun run fmt | ||
@@ -343,8 +348,8 @@ coder templates push test-[template-name] -d . | ||
terraform init -upgrade | ||
terraform test -verbose | ||
#Optional: If you have TypeScript tests | ||
bun test main.test.ts | ||
``` | ||
### 3. Maintain Backward Compatibility | ||
@@ -393,7 +398,9 @@ Example: `https://github.com/coder/registry/compare/main...your-branch?template= | ||
### Every Module Must Have | ||
- `main.tf` - Terraform code | ||
- **Tests**: | ||
- `*.tftest.hcl` files with `terraform test` (to test terraform specific logic) | ||
- `main.test.ts` file with `bun test` (to test business logic, i.e., `coder_script` to install a package.) | ||
- `README.md` - Documentation with frontmatter | ||
### Every Template Must Have | ||
@@ -493,6 +500,6 @@ When reporting bugs, include: | ||
2. **No tests** or broken tests | ||
3. **Hardcoded values** instead of variables | ||
4. **Breaking changes** without defaults | ||
5. **Not running** formatting (`bun run fmt`) and tests (`terraform test`, and `bun test main.test.ts` if applicable) before submitting | ||
Happy contributing! 🚀 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -35,13 +35,13 @@ variable "agent_id" { | ||
variable "log_path" { | ||
type = string | ||
description = "The path to logmodule-name to." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't think this is a huge deal, but I could see it being a slight source of confusion: is there a reason why we use | ||
default = "/tmp/module-name.log" | ||
} | ||
variable "port" { | ||
type = number | ||
description = "The port to runmodule-name on." | ||
default = 19999 | ||
} | ||
@@ -59,9 +59,9 @@ variable "order" { | ||
# Add other variables here | ||
resource "coder_script" "module_name" { | ||
agent_id = var.agent_id | ||
display_name = "Module Name" | ||
icon = local.icon_url | ||
script = templatefile("${path.module}/run.sh", { | ||
LOG_PATH : var.log_path, | ||
@@ -70,10 +70,10 @@ resource "coder_script" "MODULE_NAME" { | ||
run_on_stop = false | ||
} | ||
resource "coder_app" "module_name" { | ||
agent_id = var.agent_id | ||
slug = "module-name" | ||
display_name = "Module Name" | ||
url = "http://localhost:${var.port}" | ||
icon = local.icon_url | ||
subdomain = false | ||
@@ -88,10 +88,10 @@ resource "coder_app" "MODULE_NAME" { | ||
} | ||
} | ||
data "coder_parameter" "module_name" { | ||
type = "string" | ||
name = "module_name" | ||
display_name = "Module Name" | ||
icon = local.icon_url | ||
mutable = var.mutable | ||
default = local.options["Option 1"]["value"] | ||