Title: Consolidate template-wide metadata · Issue #3531 · coder/coder · GitHub
Open Graph Title: Consolidate template-wide metadata · Issue #3531 · coder/coder
X Title: Consolidate template-wide metadata · Issue #3531 · coder/coder
Description: Problem statement We currently have template-wide metadata in 2 places and have a 3rd concept in Terraform (coder_metadata). When adding new features (e.g #2221) this makes things confusing. README.md: YAML is currently appended to templ...
Open Graph Description: Problem statement We currently have template-wide metadata in 2 places and have a 3rd concept in Terraform (coder_metadata). When adding new features (e.g #2221) this makes things confusing. README...
X Description: Problem statement We currently have template-wide metadata in 2 places and have a 3rd concept in Terraform (coder_metadata). When adding new features (e.g #2221) this makes things confusing. README...
Opengraph URL: https://github.com/coder/coder/issues/3531
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consolidate template-wide metadata","articleBody":"## Problem statement\r\n\r\nWe currently have template-wide metadata in 2 places and have a 3rd concept in Terraform (coder_metadata). When adding new features (e.g #2221) this makes things confusing.\r\n\r\n1) `README.md`: YAML is currently appended to template READMEs, for use with `coder templates init`. This is already in the product. Here is an example:\r\n https://github.com/coder/coder/blob/4be61d9250512f85bc88ba9603928ca5ac706089/examples/templates/docker/README.md?plain=1#L1-L5\r\n\r\n2) `coder templates edit`: We also have a way to apply metadata to templates via `coder templates edit` for the description and schedule controls. This was apparently done so we could \"validate\" the values easier.\r\n\r\n ```sh\r\n ➜ ~ coder templates edit --help\r\n Edit the metadata of a template by name.\r\n \r\n Usage:\r\n coder templates edit \u003ctemplate> [flags]\r\n \r\n Flags:\r\n --description string Edit the template description\r\n -h, --help help for edit\r\n --max_ttl duration Edit the template maximum time before shutdown\r\n --min_autostart_interval duration Edit the template minimum autostart interval\r\n -y, --yes Bypass prompts\r\n ````\r\n\r\n3) `coder_metadata`: We have a way to attach metadata for specific resource blocks with [coder_metadata](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/metadata). The direct link to Terraform resources is necessary, hence it is done in the `.tf` file.\r\n\r\n https://github.com/coder/coder/blob/4be61d9250512f85bc88ba9603928ca5ac706089/dogfood/main.tf#L52-L60\r\n \r\n \u003cimg width=\"380\" alt=\"Screen Shot 2022-08-17 at 9 15 19 AM\" src=\"https://user-images.githubusercontent.com/22407953/185157104-405344c6-c9dd-4c2b-aa97-0787530829f2.png\">\r\n\r\n\r\n## Definition of done\r\n\r\nTemplate-wide metadata is only in one place.\r\n\r\n## Ideas\r\n\r\n\u003cdetails>\r\n \u003csummary>Postponed: use the upcoming `template.yaml` for all template-wide metadata. Use `coder_metadata` for workspace and resource-wide metadata.\r\n\u003c/summary>\r\n \r\n---\r\n\r\nWe are considering a `template.yaml` file, which includes YAML-based metadata: #2987 \r\n\r\nThis would consolidate metadata from the `README.md` (1) and from `coder templates edit` (2). \r\n\r\n```yaml\r\nversion: 1\r\nname: dogfood\r\ndescription: \"Our standard dogfood image\"\r\nschedule:\r\n max_ttl: 12h\r\n min_autostart_interval: 24h\r\n# Some future knobs\r\ndeprecated_for: \"dogfood-ts\"\r\nallow:\r\n - all\r\ndeny:\r\n - dean@coder.com\r\nicon: /icons/dog.png\r\n```\r\n\r\n`coder_metadata` (3) can remain in the Terraform for workspace-scoped and resource-scoped metadata since it may rely on dynamic values from Terraform. However, it is not used for things in the template-wide or in the templates page (description, icon, TTL, etc):\r\n\r\n```diff\r\nresource \"coder_metadata\" \"template\" {\r\n- resource_id = \"\"\r\n+ workspace_wide = true;\r\n item {\r\n key = \"Workspace broken?\"\r\n value = \"[Create Ticket](https://internal-support.com/tickets/new/?type=coder&workspaceid=${data.coder_workspace.me.id}\"\r\n }\r\n quicklinks = \"Run workspaces on a Docker host using registry images\"\r\n }\r\n ```\r\n\u003c/details>\r\n\r\n✅ Solution discussed by @bpmct @BrunoQuaresma @kylecarbs: Manage metadata via CLI (`coder templates edit`) and \"Edit Template\" page in the dashboard. Remove metadata from README entirely. This follows the model of GitHub and Vercel where some properties are just \"editable\"\r\n\r\nResource and workspace metadata will be used by `coder_metadata`\r\n\r\n\u003cimg width=\"300\" alt=\"Screen Shot 2022-08-17 at 11 21 49 AM\" src=\"https://user-images.githubusercontent.com/22407953/185194667-1d7ffe7f-a9b8-4490-a5da-17b8f5443a57.png\">\r\n\u003cimg width=\"300\" alt=\"Screen Shot 2022-08-17 at 11 21 15 AM\" src=\"https://user-images.githubusercontent.com/22407953/185194669-a499006e-2e6f-4147-ba29-31c07f3e2729.png\">\r\n\r\nThis will make our dashboard more interactive and make these features feel more fun and easy to use. Down the road, `template.yaml` (#2987) can be used to \"disable\" manual editing by admins so that it's managed as a part of GitOps.","author":{"url":"https://github.com/bpmct","@type":"Person","name":"bpmct"},"datePublished":"2022-08-17T14:43:07Z","url":"https://github.com/coder/coder/issues/3531"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:10b57ae6-f94c-1547-534c-2b3e45a09ece |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFFA:2AAD2E:21D670E:2D248E5:6B018D3E |
| html-safe-nonce | 141e0ebbf3174db8e745236148a78f9b42092e068bdc688c1e08489e0ae9625e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkZBOjJBQUQyRToyMUQ2NzBFOjJEMjQ4RTU6NkIwMThEM0UiLCJ2aXNpdG9yX2lkIjoiNDI2OTI5NDMwNjg3NzA4Mjk0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8a533a7443a3d9fb81469a1e4dd91175bf00c3e2cbf2df45db9e908c6233334f |
| hovercard-subject-tag | issue:1341878708 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/3531/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a048c5740fca9ad9b14cbb5e37c72b042aaa2c8ce5c3ca5efd8cf44cb26f0513/coder/coder/issues/3531 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a048c5740fca9ad9b14cbb5e37c72b042aaa2c8ce5c3ca5efd8cf44cb26f0513/coder/coder/issues/3531 |
| og:image:alt | Problem statement We currently have template-wide metadata in 2 places and have a 3rd concept in Terraform (coder_metadata). When adding new features (e.g #2221) this makes things confusing. README... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bpmct |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width