opentelemetry-helm-charts icon indicating copy to clipboard operation
opentelemetry-helm-charts copied to clipboard

[project] Improve `make generate-examples` to use pre-commit and run faster

Open jvoravong opened this issue 7 months ago • 4 comments

In my downstream project, we've implemented several improvements to our make generate-examples workflow that have significantly improved contributor experience and CI feedback loops. I'd like to propose upstreaming these enhancements to this project.

Proposed Improvements

  • Pre-commit Integration for Examples

    • We use pre-commit to ensure every commit includes up-to-date generated examples.
    • This helps contributors automatically stay compliant with project standards and avoids the need to leave comments like “please update the examples” on PRs.
  • Parallelized Example Generation

    • We updated our render.sh script to render examples in parallel rather than sequentially. Without parallelization, generating example between each commit was very noticable.
    • This change made generation time negligible, even when running on every commit, which greatly improved CI performance and developer feedback loops.

Optional Side Discussion: How Many Examples Should This Project Support?

  • In my project since we could generate many examples quickly, we started to support many examples (50+ examples), each with a values.yaml, rendered output, and usage docs. This has made it easier for contributors to understand complex Helm logic, but it also potentially increases PR sizes due to the generated example content.
  • For interested parties, I'd like to gauge interest and help determine a standard for how much example content this project should support. Please react with an emoji next to your preferred option:
  • 🎉 Support many detailed examples, even if PRs are larger
  • 🚀 Keep the example set lean and minimal, less is more
  • ❤️ Strike a balance — maintain a reasonable number with a clear rule of thumb

jvoravong avatar Apr 01 '25 17:04 jvoravong

@jvoravong would this make it so that contributors wouldnt need to run make generate-examples themselves? That would be wonderful

TylerHelmuth avatar Apr 11 '25 15:04 TylerHelmuth

@TylerHelmuth This update ensures example files stay in sync with each commit. If pre-commit is installed locally, it will auto-generate the updated examples. If not, the PR will fail the pre-commit check and notify contributors to update the examples.

Feel free to assign this to me, I'm happy to take it on in the next couple of weeks.

jvoravong avatar Apr 11 '25 22:04 jvoravong

we can close this issue as https://github.com/open-telemetry/opentelemetry-helm-charts/pull/1573 finished it?

JaredTan95 avatar May 11 '25 12:05 JaredTan95

I don't think so, as that commit didn't do anything with example generation.

TylerHelmuth avatar May 11 '25 18:05 TylerHelmuth