Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

hugodutka
Copy link
Contributor

@hugodutka hugodutka commented Nov 27, 2024

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
Copy link
Member

@Emyrk Emyrk left a comment

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
Contributor 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
Copy link
Member

Emyrk commented Nov 27, 2024

@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
Contributor 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.

Copy link
Member

@Emyrk Emyrk left a comment

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
35 checks passed
@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 <hugo@coder.com>
Co-authored-by: Sas Swart <sas.swart.cdk@gmail.com>
Co-authored-by: Spike Curtis <spike@coder.com>
Co-authored-by: Cian Johnston <cian@coder.com>
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