Skip to content

chore: track usage of built-in example templates - #15671

Merged
hugodutka merged 3 commits into
mainfrom
hugodutka/track-example-templates
Nov 27, 2024
Merged

hugodutka merged 3 commits into
mainfrom
hugodutka/track-example-templates

Conversation

@hugodutka

@hugodutka hugodutka commented Nov 27, 2024 •

Copy link
Copy Markdown
Collaborator

Addresses https://github.com/coder/nexus/issues/99.

Changes:

  • Save the id of the built-in example template used to create a template version in the database
  • Include the example id in telemetry

@hugodutka
hugodutka marked this pull request as ready for review November 27, 2024 13:01
@hugodutka
hugodutka requested a review from Emyrk November 27, 2024 13:05

@Emyrk Emyrk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just adds the ID column, it does not add uuid's to our built in templates yet right?

Are we going to add uuids to our builtins? Or should it be a string, eg: github.com/coder/templates/official/aws-linux

And do we need version control?

github.com/coder/templates/official/aws-linux@ad4efa53708e60a7094ef9687e7dfda0441aaec7?

@hugodutka

Copy link
Copy Markdown
Collaborator Author

This just adds the ID column, it does not add uuid's to our built in templates yet right?

That's correct.

Are we going to add uuids to our builtins? Or should it be a string, eg: github.com/coder/templates/official/aws-linux

Hmm, I haven't heard anything about that before. Were there any plans?

And do we need version control?

In telemetry, we can infer the built-in template version from the deployment version. From my perspective we don't need additional version control.

@Emyrk

Emyrk commented Nov 27, 2024

Copy link
Copy Markdown
Member

@hugodutka 👍

Hmm, I haven't heard anything about that before. Were there any plans?

This PR adds a column to track the built in template source by uuid correct? Do built ins have a consistent uuid across all deployments?

@hugodutka

Copy link
Copy Markdown
Collaborator Author

This PR adds a column to track the built in template source by uuid correct? Do built ins have a consistent uuid across all deployments?

Built-in templates have consistent, human-readable ids. These correspond to folder names in https://github.com/coder/coder/tree/main/examples/templates.

The examples are embedded in the binary here:

var (
// Only some templates are embedded that we want to display inside the UI.
// The metadata in examples.gen.json is generated via scripts/examplegen.
//go:embed examples.gen.json
//go:embed templates/aws-devcontainer
//go:embed templates/aws-linux
//go:embed templates/aws-windows
//go:embed templates/azure-linux
//go:embed templates/do-linux
//go:embed templates/docker
//go:embed templates/devcontainer-docker
//go:embed templates/devcontainer-kubernetes
//go:embed templates/gcp-devcontainer
//go:embed templates/gcp-linux
//go:embed templates/gcp-vm-container
//go:embed templates/gcp-windows
//go:embed templates/kubernetes
//go:embed templates/nomad-docker
//go:embed templates/scratch
files embed.FS

So this PR tracks them by these human-readable ids.

@Emyrk Emyrk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Got it, that tracks!

@hugodutka
hugodutka merged commit b830c05 into main Nov 27, 2024
@hugodutka
hugodutka deleted the hugodutka/track-example-templates branch November 27, 2024 19:01
stirby pushed a commit that referenced this pull request Dec 2, 2024
Addresses coder/nexus#99.

Changes:
- Save the id of the built-in example template used to create a template
version in the database
- Include the example id in telemetry

(cherry picked from commit b830c05)
stirby added a commit that referenced this pull request Dec 3, 2024
- #15589
- #15683
- #15671

---------

Co-authored-by: Hugo Dutka <[email protected]>
Co-authored-by: Sas Swart <[email protected]>
Co-authored-by: Spike Curtis <[email protected]>
Co-authored-by: Cian Johnston <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants