Skip to content

Commit 466389d

Browse files
committed
chore: revise contributing README
1 parent 4fd105d commit 466389d

File tree

1 file changed

+93
-66
lines changed

1 file changed

+93
-66
lines changed

CONTRIBUTING.md

Lines changed: 93 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
This repo uses two main runtimes to verify the correctness of a module/template before it is published:
66

77
- [Bun](https://bun.sh/) – Used to run tests for each module/template to validate overall functionality and correctness of Terraform output
8-
- [Go](https://go.dev/) – Used to validate all README files in the directory
8+
- [Go](https://go.dev/) – Used to validate all README files in the directory. The README content is used to populate [the Registry website](https://registry.coder.com).
99

1010
### Installing Bun
1111

@@ -51,34 +51,24 @@ go version
5151

5252
## Namespaces
5353

54-
All Coder resources are scoped to namespaces placed at the top level of the `/registry` directory. Any modules or templates must be placed inside a namespace to be accepted as a contribution. For example, all modules created by TheZoker would be placed under `/registry/TheZoker/modules`, with a subdirectory for each individual module.
54+
All Coder resources are scoped to namespaces placed at the top level of the `/registry` directory. Any modules or templates must be placed inside a namespace to be accepted as a contribution. For example, all modules created by TheJonkler would be placed under `/registry/thejonkler/modules`, with a subdirectory for each individual module the user has published.
5555

56-
If a name is already taken, you will need to create a subdirectory under a different name, but you will still be able to choose any display name.
56+
If a namespace is already taken, you will need to create a different, unique namespace, but will still be able to choose any display name. (The display name is shown in the Registry website. More info below.)
5757

58-
### Contributor README files
58+
### Namespace (contributor profile) README files
5959

60-
Each namespace directory must contain a `README.md` file containing metadata about who you are as a contributor. Each README file must contain frontmatter with required metadata fields, but there are no restrictions on the body of the README. Feel free to customize it to your heart's content (within reason – the CI step will check for accessibility violations).
61-
62-
The frontmatter must contain the following fields:
63-
64-
- `display_name` (required string) – The name to use when displaying your user profile in the Coder Registry site
65-
- `bio` (optional string) – A short description of who you are
66-
- `github` (optional string) – Your GitHub handle
67-
- `avatar_url` (optional string) – A relative/absolute URL pointing to your avatar for the Registry site. It is strongly recommended that you add avatar images to this repo and reference them via relative URLs.
68-
- `linkedin` (optional string) – A URL pointing to your LinkedIn page
69-
- `support_email` (optional string) – An email for users to reach you at if they need help with a published module/template
70-
- `status` (optional string union) – If defined, must be one of `"community"`, `"partner"`, or `"official"`. `"community"` is treated as the default value if not specified, and should be used for the majority of external contributions. `"official"` should be used for Coder and Coder satellite companies. `"partner"` is for companies who have a formal business partnership with Coder.
60+
More information about contributor profile README files can be found below.
7161

7262
### Images
7363

74-
Any images needed for either the main namespace directory or a module/template can be placed in a relative `/images` directory at the top of the namespace directory. This is to minimize the risk of file name conflicts between different users.
64+
Any images needed for either the main namespace directory or a module/template can be placed in a relative `/images` directory at the top of the namespace directory. (e.g., The Jonkler can have a `/registry/thejonkler/images` directory, that can be referenced by the main README file, as well as a README file in `/registry/thejonkler/modules/custom_module/README.md`.) This is to minimize the risk of file name conflicts between different users as they add images to help illustrate parts of their README files.
7565

7666
## Coder modules
7767

7868
### Adding a new module
7969

80-
> [!NOTE]
81-
> This script will be available shortly. These instructions cannot be followed just yet. Contributors looking to add modules early will need to create all directories manually.
70+
> [!WARNING]
71+
> These instructions cannot be followed just yet; the script referenced will be made available shortly. Contributors looking to add modules early will need to create all directories manually.
8272
8373
Once Bun (and possibly Go) have been installed, clone the Coder Registry repository. From there, you can run this script to make it easier to start contributing a new module or template:
8474

@@ -98,44 +88,48 @@ Each Coder Module must contain the following files:
9888

9989
You are free to include any additional files in the module, as needed by the module. For example, the [Windows RDP module](https://github.com/coder/registry/tree/main/registry/coder/modules/windows-rdp) contains additional files for injecting specific functionality into a Coder Workspace.
10090

101-
### The structure of a module README
91+
> [!NOTE]
92+
> Some legacy modules do not have test files defined just yet. This will be addressed soon.
10293
103-
All requirements listed below are validating using our CI process. A README file must have:
94+
### The `main.tf` file
10495

105-
- Frontmatter that describes metadata for the module:
106-
- `display_name` (required string) – This is the name displayed on the Coder Registry website
107-
- `description` (required string) – A short description of the module, which is displayed on the Registry website
108-
- `icon` (required URL) – A relative/absolute URL pointing to the icon to display for the module in the Coder Registry website.
109-
- `maintainer_github` (deprecated string) – The name of the creator of the module. This field exists for backwards compatibility with previous versions of the Registry, but going forward, the value will be calculated from the namespace directory.
110-
- `partner_github` (deprecated string)
111-
- `verified` (optional boolean) – Indicates whether the module has been officially verified by Coder.
112-
- `tags` (required string array) – A list of metadata tags to describe the module. Used in the Registry site for search and navigation functionality.
113-
- An H1 header with the name of the module
114-
- The following content directly under the h1 header (without another header between them):
115-
- A description of what the module does
116-
- A Terraform snippet for letting other users import the functionality
96+
This file defines all core Terraform functionality, to be mixed into your Coder workspaces. More information about [Coder's use of Terraform can be found here](https://coder.com/docs/admin/templates/extending-templates/modules), and [general information about the Terraform language can be found in the official documentation](https://developer.hashicorp.com/terraform/docs).
11797

118-
Additional information can be placed in the README file below the content listed above, using any number of headers.
98+
### The structure of a module README
99+
100+
Validation criteria for module README files is listed below.
119101

120102
### Testing a Module
121103

122104
> [!IMPORTANT]
123-
> It is the responsibility of the module author to implement tests for every new module they wish to contribute. It falls to the author to test the module locally before submitting a PR.
105+
> It is the responsibility of the module author to implement tests for every new module they wish to contribute. It is expected the author has tested the module locally before opening a PR. Feel free to reference existing test files to get an idea for how to set them up.
124106
125107
All general-purpose test helpers for validating Terraform can be found in the top-level `/testing` directory. The helpers run `terraform apply` on modules that use variables, testing the script output against containers.
126108

109+
When writing a test file, you can import the test utilities via the `~test` import alias:
110+
111+
```ts
112+
// This works regardless of how deeply-nested your test file is in the file
113+
// structure
114+
import {
115+
runTerraformApply,
116+
runTerraformInit,
117+
testRequiredVariables,
118+
} from "~test";
119+
```
120+
127121
> [!NOTE]
128-
> The testing suite must be able to run docker containers with the `--network=host` flag. This typically requires running the tests on Linux as this flag does not apply to Docker Desktop for MacOS and Windows. MacOS users can work around this by using something like [colima](https://github.com/abiosoft/colima) or [Orbstack](https://orbstack.dev/) instead of Docker Desktop.
122+
> The testing suite must be able to run docker containers with the `--network=host` flag. This typically requires running the tests on Linux as this flag does not apply to Docker Desktop for MacOS or Windows. MacOS users can work around this by using something like [colima](https://github.com/abiosoft/colima) or [Orbstack](https://orbstack.dev/) instead of Docker Desktop.
129123
130-
You can reference the existing `*.test.ts` files to get an idea for how to set up tests.
124+
#### Running tests
131125

132126
You can run all tests by running this command from the root of the Registry directory:
133127

134128
```shell
135129
bun test
136130
```
137131

138-
Note that tests can take some time to run, so you probably don't want to be running this as part of your core development loop.
132+
Note that running _all_ tests can take some time, so you likely don't want to be running this command as part of your core development loop.
139133

140134
To run specific tests, you can use the `-t` flag, which accepts a filepath regex:
141135

@@ -152,9 +146,9 @@ module "example" {
152146
}
153147
```
154148

155-
## Adding/modifying README files
149+
## Updating README files
156150

157-
This repo uses Go to do a quick validation of each README file. If you are working with the README files at all (i.e., creating them, modifying them), it is strongly recommended that you install Go, so that the files can be validated locally.
151+
This repo uses Go to validate each README file. If you are working with the README files at all (i.e., creating them, modifying them), it is strongly recommended that you install Go (installation instructions mentioned above), so that the files can be validated locally.
158152

159153
### Validating all README files
160154

@@ -164,25 +158,25 @@ To validate all README files throughout the entire repo, you can run the followi
164158
go build ./cmd/readmevalidation && ./readmevalidation
165159
```
166160

167-
The resulting binary is already part of the `.gitignore` file, but you can quickly remove it with:
161+
The resulting binary is already part of the `.gitignore` file, but you can remove it with:
168162

169163
```shell
170164
rm ./readmevalidation
171165
```
172166

173167
### README validation criteria
174168

175-
The following criteria exists for one of two reasons: (1) content accessibility, or (2) having content be designed in a way that's easy for the Registry site build step to use:
169+
The following criteria exists for two reasons:
170+
171+
1. Content accessibility
172+
2. Having content be designed in a way that's easy for the Registry site build step to use
176173

177174
#### General README requirements
178175

179176
- There must be a frontmatter section.
180-
- There must be exactly one h1 header, and it must be at the very top
177+
- There must be exactly one h1 header, and it must be at the very top, directly below the frontmatter.
181178
- The README body (if it exists) must start with an h1 header. No other content (including GitHub-Flavored Markdown alerts) is allowed to be placed above it.
182179
- When increasing the level of a header, the header's level must be incremented by one each time.
183-
- Additional image/video assets can be placed in one of two places:
184-
- In the same user namespace directory where that user's main content lives
185-
- In the top-level `.icons` directory
186180
- Any `.hcl` code snippets must be labeled as `.tf` snippets instead
187181

188182
```txt
@@ -191,27 +185,60 @@ The following criteria exists for one of two reasons: (1) content accessibility,
191185
\`\`\`
192186
```
193187

194-
#### Contributor profiles
195-
196-
- The README body is allowed to be empty, but if it isn't, it must follow all the rules above.
197-
- The frontmatter supports the following fields:
198-
- `display_name` (required string) – The name to use when displaying your user profile in the Coder Registry site
199-
- `bio` (optional string) – A short description of who you are
200-
- `github` (required string) – Your GitHub handle
201-
- `avatar_url` (optional string) – A relative/absolute URL pointing to your avatar
202-
- `linkedin` (optional string) – A URL pointing to your LinkedIn page
203-
- `support_email` (optional string) – An email for users to reach you at if they need help with a published module/template
204-
- `employer_github` (optional string) – The name of another user namespace whom you'd like to have associated with your account. The namespace must also exist in the repo, or else the README validation will fail.
205-
- `status` (optional string union) – If defined, must be one of "community", "partner", or "official". "Community" is treated as the default value if not specified, and should be used for the majority of external contributions. "Official" should be used for Coder and Coder satellite companies. "Partner" is for companies who have a formal business agreement with Coder.
206-
207-
#### Modules and templates
208-
209-
- The frontmatter supports the following fields:
210-
- `description` (required string) A short description of what the module/template does.
211-
- `icon` (required string) – A URL pointing to the icon to use for the module/template when viewing it on the Registry website.
212-
- `display_name` (optional string) – A name to display instead of the name intuited from the module's/template's directory name
213-
- `verified` (optional boolean) – A boolean indicated that the Coder team has officially tested and vouched for the functionality/reliability of a given module or template. This field should only be changed by Coder employees.
214-
- `tags` (optional string array) – A list of tags to associate with the module/template. Users will be able to search for these tags from the Registry website.
188+
#### Namespace (contributor profile) criteria
189+
190+
In addition to the general criteria, all README files must have the following:
191+
192+
- Frontmatter metadata with support for the following fields:
193+
194+
- `display_name` (required string) – The name to use when displaying your user profile in the Coder Registry site.
195+
- `bio` (optional string) – A short description of who you are.
196+
- `github` (optional string) – Your GitHub handle.
197+
- `avatar_url` (optional string) – A relative/absolute URL pointing to your avatar for the Registry site. It is strongly recommended that you commit avatar images to this repo and reference them via a relative URL.
198+
- `linkedin` (optional string) – A URL pointing to your LinkedIn page.
199+
- `support_email` (optional string) – An email for users to reach you at if they need help with a published module/template.
200+
- `status` (optional string union) – If defined, this must be one of `"community"`, `"partner"`, or `"official"`. `"community"` is treated as the default value if not specified, and should be used for the majority of external contributions. `"partner"` is for companies who have a formal business partnership with Coder. `"official"` should be used only by Coder and Coder satellite companies.
201+
202+
- The README body (the content that goes directly below the frontmatter) is allowed to be empty, but if it isn't, it must follow all the rules above.
203+
204+
You are free to customize the body of a contributor profile however you like, adding any number of images or information. Its content will never be rendered in the Registry website.
205+
206+
Additional information can be placed in the README file below the content listed above, using any number of headers.
207+
208+
Additional image/video assets can be placed in the same user namespace directory where that user's main content lives.
209+
210+
#### Module criteria
211+
212+
In addition to the general criteria, all README files must have the following:
213+
214+
- Frontmatter that describes metadata for the module:
215+
- `display_name` (required string) – This is the name displayed on the Coder Registry website
216+
- `description` (required string) – A short description of the module, which is displayed on the Registry website
217+
- `icon` (required string) – A relative/absolute URL pointing to the icon to display for the module in the Coder Registry website.
218+
- `verified` (optional boolean) – Indicates whether the module has been officially verified by Coder. Please do not set this without approval from a Coder employee.
219+
- `tags` (required string array) – A list of metadata tags to describe the module. Used in the Registry site for search and navigation functionality.
220+
- `maintainer_github` (deprecated string) – The name of the creator of the module. This field exists for backwards compatibility with previous versions of the Registry, but going forward, the value will be inferred from the namespace directory.
221+
- `partner_github` (deprecated string) - The name of any additional creators for a module. This field exists for backwards compatibility with previous versions of the Registry, but should not ever be used going forward.
222+
- The following content directly under the h1 header (without another header between them):
223+
224+
- A description of what the module does
225+
- A Terraform snippet for letting other users import the functionality
226+
227+
```tf
228+
module "cursor" {
229+
count = data.coder_workspace.me.start_count
230+
source = "registry.coder.com/modules/cursor/coder"
231+
version = "1.0.19"
232+
agent_id = coder_agent.example.id
233+
}
234+
```
235+
236+
Additional information can be placed in the README file below the content listed above, using any number of headers.
237+
238+
Additional image/video assets can be placed in one of two places:
239+
240+
1. In the same user namespace directory where that user's main content lives
241+
2. If the image is an icon, it can be placed in the top-level `.icons` directory (this is done because a lot of modules will be based off the same products)
215242
216243
## Releases
217244

0 commit comments

Comments
 (0)