You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(coder plugin): make template names optional (#103)
* wip: update type definitions and parsing logic for config values
* refactor: update some code for clarity
* fix: update property names in top-level config
* wip: commit progress on link update
* chore: finish updates for CreateWorkspaceLink
* chore: add new test case for disabled state
* fix: cleanup markup and text for EntityDataReminder
* chore: add readEntityData as context value
* refactor: rename DataEntityReminder to ReminderAcoordionItem
* chore: extract core accordion item logic to parent
* chore: finish initial version of ReminderAccordion
* wip: commit test stubs for ReminderAccordion
* chore: rename isReadingEntityData prop
* chore: update mock context values in tests
* wip: commit test stub for hiding cta button when there is no repo URL
* chore: hide CTA button when there is no repo URL
* chore: rename AccordionItem to Disclosure
* chore: update tests for Disclosure
* chore: remove needless hasAssertions calls
* fix: update conditional logic for ReminderAccordion
* fix: more accordion bug fixes
* chore: finish another test case
* chore: add another accordion test case
* refactor: rename props for clarity
* refactor: simplify condition for entity reminder
* refactor: update prop for Disclosure
* chore: finish all tests for accordion
* refactor: update type definition for mock config
* refactor: polish up accordion tests
* chore: finish up all tests
* fix: add missing property to mock setup to help compiler pass
* refactor: move isReadingEntityData property to workspaces config
* fix: add overflow-y and max height behavior to accordion
* chore: polish styling for accordion
* fix: add reminder accordion as exported plugin component
* refactor: rename imported component to reduce visual noise when reading
* fix: make no-link message more clear for button
* fix: update text to account for new tooltip
* docs: add page about catalog-info
* docs: finish all docs updates for coder plugin
* docs: add docs section for ReminderAccordion
* fix: update link for documentation in UI
// catalog items. Individual properties can be overridden
63
+
// by a repo's catalog-info.yaml file
63
64
workspaces: {
64
-
templateName: 'devcontainers',
65
-
mode: 'manual',
66
-
// This parameter is used to filter Coder workspaces
67
-
// by a repo URL parameter.
65
+
defaultTemplateName: 'devcontainers',
66
+
defaultMode: 'manual',
67
+
68
+
// This property defines which parameters in your Coder
69
+
// workspace templates are used to store repository links
68
70
repoUrlParamKeys: ['custom_repo', 'repo_url'],
71
+
69
72
params: {
70
73
repo: 'custom',
71
74
region: 'eu-helsinki',
@@ -88,7 +91,7 @@ the Dev Container.
88
91
89
92
**Note:** You can also wrap a single page or component with `CoderProvider` if you only need Coder in a specific part of your app. See our [API reference](./docs/README.md) (particularly the section on [the `CoderProvider` component](./docs/components.md#coderprovider)) for more details.
90
93
91
-
1. Add the `CoderWorkspacesCard` card to the entity page in your app:
94
+
4. Add the `CoderWorkspacesCard` card to the entity page in your app:
92
95
93
96
```tsx
94
97
// In packages/app/src/components/catalog/EntityPage.tsx
@@ -101,6 +104,33 @@ the Dev Container.
101
104
</Grid>;
102
105
```
103
106
107
+
### `app-config.yaml` files
108
+
109
+
In addition to the above, you can define additional properties on your specific repo's `catalog-info.yaml` file.
110
+
111
+
Example:
112
+
113
+
```yaml
114
+
apiVersion: backstage.io/v1alpha1
115
+
kind: Component
116
+
metadata:
117
+
name: python-project
118
+
spec:
119
+
type: other
120
+
lifecycle: unknown
121
+
owner: pms
122
+
123
+
# Properties for the Coder plugin are placed here
124
+
coder:
125
+
templateName: 'devcontainers'
126
+
mode: 'auto'
127
+
params:
128
+
repo: 'custom'
129
+
region: 'us-pittsburgh'
130
+
```
131
+
132
+
You can find more information about what properties are available (and how they're applied) in our [`catalog-info.yaml` file documentation](./docs/catalog-info.md).
133
+
104
134
## Roadmap
105
135
106
136
This plugin is in active development. The following features are planned:
This file provides documentation for all properties that the Coder plugin recognizes from Backstage's [`catalog-info.yaml` files](https://backstage.io/docs/features/software-catalog/descriptor-format/).
4
+
5
+
## Example file
6
+
7
+
```yaml
8
+
apiVersion: backstage.io/v1alpha1
9
+
kind: Component
10
+
metadata:
11
+
name: python-project
12
+
spec:
13
+
type: other
14
+
lifecycle: unknown
15
+
owner: pms
16
+
17
+
# Properties for the Coder plugin are placed here
18
+
coder:
19
+
templateName: 'devcontainers'
20
+
mode: 'auto'
21
+
params:
22
+
repo: 'custom'
23
+
region: 'us-pittsburgh'
24
+
```
25
+
26
+
All config properties are placed under the `spec.coder` property.
27
+
28
+
## Where these properties are used
29
+
30
+
At present, there are two main areas where these values are used:
31
+
32
+
- [`CoderWorkspacesCard`](./components.md#coderworkspacescard) (and all sub-components)
This defines the name of the Coder template you would like to use when creating new workspaces from Backstage.
42
+
43
+
**Note:** This value has overlap with the `defaultTemplateName` property defined in [`CoderAppConfig`](types.md#coderappconfig). In the event that both values are present, the YAML file's `templateName` property will always be used instead.
44
+
45
+
### `templateName`
46
+
47
+
**Type:** Optional union of `manual` or `auto`
48
+
49
+
This defines the workspace creation mode that will be embedded as a URL parameter in any outgoing links to make new workspaces in your Coder deployment. (e.g.,`useCoderWorkspacesConfig`'s `creationUrl` property)
50
+
51
+
**Note:** This value has overlap with the `defaultMode` property defined in [`CoderAppConfig`](types.md#coderappconfig). In the event that both values are present, the YAML file's `mode` property will always be used instead.
52
+
53
+
### `params`
54
+
55
+
**Type:** Optional JSON object of string values (equivalent to TypeScript's `Record<string, string | undefined>`)
56
+
57
+
This allows you to define additional Coder workspace parameter values that should be passed along to any outgoing URLs for making new workspaces in your Coder deployment. These values are fully dynamic, and unfortunately, cannot have much type safety.
58
+
59
+
**Note:** The properties from the `params` property are automatically merged with the properties defined via `CoderAppConfig`'s `params` property. In the event of any key conflicts, the params from `catalog-info.yaml` will always win.
0 commit comments