rajatjindal / krew-release-bot

bot to bump version of plugin in krew-index on new releases
Apache License 2.0
47 stars 17 forks source link

feat: add extracting version from tag for template #65

Closed grafvonb closed 1 year ago

grafvonb commented 1 year ago

Sometimes it is necessary to use a pure version instead of a tag value, e.g. instead of v0.0.1 simply 0.0.1. This feature extends the data structure passed to the .krew.yaml template, allowing the use of {{ .Version }} when necessary. If the tag does not contain a version, the value of the tag is used without any modification to avoid returning an empty string.

netlify[bot] commented 1 year ago

Deploy request for inspiring-brown-e0fe87 pending review.

Visit the deploys page to approve it

Name Link
Latest commit 12767d16a333ea47177c94cb9dea3ee9277a012f
grafvonb commented 1 year ago

/assign @rajatjindal

rajatjindal commented 1 year ago

Hi @grafvonb

Thank you for opening the PR.

I was wondering if something like {{ trimPrefix \"v\" .TagName }} will work you?

Please note that trimPrefix is currently not available in templating, but we can add that.

grafvonb commented 1 year ago

Hi @rajatjindal, my idea was to have a function that is able to "extract" the version from any string, even if someone would use a tag like "V1.0.1-beta" if required, but your solution might be simpler especially if we just want to cover standard behavior of goreleaser which creates files without v. Actually I would be happy to have both possibilities :).

rajatjindal commented 1 year ago

The thing that concerns me is that exposing both tag and version as template variables will create confusion for the users.

Also, the krew-release-bot does not support beta versions.krew-index enforces that the tag version is a semantic version string. (see https://krew.sigs.k8s.io/docs/developer-guide/plugin-manifest/)

Keeping this in mind, I am not convinced to add another template variable and would request you consider using the solution I suggested earlier.

Although I might be missing some scenarios that may force me to change my opinion here, in that case, please feel free to share your thoughts.