Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/aggregation/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ type CoderTemplateSpec struct {
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`

// Files is the template source tree for the active template version.
//
// Keys are slash-delimited relative paths (e.g. "main.tf").
// Values are UTF-8 file contents.
//
// Populated on GET; intentionally omitted from LIST to keep responses small.
// On CREATE/UPDATE with files, the server uploads source and creates a new template version.
Files map[string]string `json:"files,omitempty"`

// Running is a legacy flag retained temporarily for in-repo callers that still read template run-state directly.
Running bool `json:"running,omitempty"`
}
Expand Down
9 changes: 8 additions & 1 deletion api/aggregation/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference/api/codertemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| `displayName` | string | |
| `description` | string | |
| `icon` | string | |
| `files` | object (keys:string, values:string) | Files is the template source tree for the active template version. Keys are slash-delimited relative paths (e.g. "main.tf"). Values are UTF-8 file contents. Populated on GET; intentionally omitted from LIST to keep responses small. On CREATE/UPDATE with files, the server uploads source and creates a new template version. |
| `running` | boolean | Running is a legacy flag retained temporarily for in-repo callers that still read template run-state directly. |

## Status
Expand Down
17 changes: 17 additions & 0 deletions internal/aggregated/convert/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,20 @@ func TemplateCreateRequestFromK8s(obj *aggregationv1alpha1.CoderTemplate, templa
Icon: obj.Spec.Icon,
}, nil
}

// TemplateUpdateMetaRequestFromK8s builds a codersdk.UpdateTemplateMeta request.
func TemplateUpdateMetaRequestFromK8s(obj *aggregationv1alpha1.CoderTemplate) codersdk.UpdateTemplateMeta {
if obj == nil {
panic("assertion failed: template object must not be nil")
}

displayName := obj.Spec.DisplayName
description := obj.Spec.Description
icon := obj.Spec.Icon

return codersdk.UpdateTemplateMeta{
DisplayName: &displayName,
Description: &description,
Icon: &icon,
}
}
Loading