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
(reverted) Add useChartVersion
and change appended version suffix (now like 1.2.3-0.dev.git.3.h123
)
#150
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Another related idea- include something along the lines of bump2version or tbump in chartpress to reduce the cognitive load in figuring out the version and ensuring you don't accidentally create a tag that doesn't appear in the correct. The above discussion about rc/alpha/beta etc is quite complicated, so being able to tell chartpress to bump a version based on a limited choice (e.g. major/minor/patch/dev/rc) could be helpful instead of making it completely free text as in #152? |
Yeah, integrating with tbump might be nice for setting the version. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Given a base version (last tag from git describe, or 'current' version from chart):
Given 5 commits from the last tag and sha='abc', this would produce tags:
Importantly, this does not solve the "dev versions sort after releases" if you don't opt-in to the version-from-chart scheme or use dev tags. This is the situation we have today, and I think it's appropriate to say that you should get the version from the chart if you want prereleases to be relative to the releases they are actually 'pre.' I don't think we should be guessing what the next release might be.
opt-in, use the version in the chart exactly as-is (optionally: strip a standard '-set.by.chartpress' suffix): If `config["versionFromChart"]`:
base_version = chart["version"]
else:
base_version = last_tag_on_branch
Yes, I believe it should be: V=2.0.0
# equivalent of tbump $V
chartpress --reset --tag "$V"
git commit -a -m "bump version to $V"
git tag -a -m "release $V" "$V"
NEXT_V = "2.1.0-0.dev"
# equivalent of tbump --no-tag $NEXT_V
chartpress --reset --tag "$NEXT_V"
git commit -a -m "bump version to $NEXT_V"
git push --atomic
# next published chart version will be 2.1.0-0.dev.git.1.habc Optionally, we could have chartpress execute the git commit/tag, like tbump does. You would get the same versions if you skipped the versionFromChart scheme if you tagged the commit after release as The NEXT_V step is only necessary for releases, not prereleases (alpha, beta, etc.). If you skip/omit the additional NEXT_V commit, the only downside is that your prereleases will evaluate below your last release (as is already the case today). |
This comment was marked as outdated.
This comment was marked as outdated.
Yes, I should have been clearer. It's the right place semantically, but it's not available to us, which is why we have the issues we are having now - putting information relative to the last release in a field counting down from it.
True, and this is what EDIT by Erik: I opened #174 about this.
I think
I think we do need something in chartpress.yaml to make the new behavior opt-in. I'm not sure it should be the version itself, though. I think that should be in the Chart.yaml, since there's already a field for it and we should use it. I think it should be your option b): "if chartpress.yaml config says it should" as that's the simplest, most explicit choice. Nothing to infer from something else.
I think the right thing to do here is to strip the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not feeling confident about this still, but I made a review pass. By mistake I made comments associated with a specific commit instead of the entire PR =/
Instead of `1.2.3-n003.habc` produce `1.2.3-0git.3.habc` - allow fully numerical fields (Leading 0s are only forbidden for numerical fields, not alphanumeric) - prefix with `0git.` to sort before 'alpha'
- prefix version with `-0.dev.git.{n}.h{sha}` or `-existingPreRelease.git.{n}.h{sha}` - optionally get base version from Chart.version - reset only strips git suffix instead of clobbering with resetVersion
@consideRatio resolved conflicts with #173 |
for more information, see https://pre-commit.ci
Thanks @minrk! I'm looking at this now and trying to go through all the comments and understand the current state and summarize the situation and what we are going for. I hope it is okay that i mark comments as outdated, this PR has lots of discussion that it becomes hard to overview. I figure hiding disucssion that led up to the current state makes it more managable - if not only for myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @minrk for your work on this!
I think this is acceptable pretty much as it is, I left some smaller comments and I didn't review the tests but I hope its okay to go for anyhow.
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
for more information, see https://pre-commit.ci
conflict resolution removed capture_output change
useChartVersion
and change appended version suffix (now like 1.2.3-0.dev.git.3.h123
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found logic introuced that with the chartpress
CLI is unreachable that I'm not sure how it makes sense to rework.
@consideRatio I tried to make the reset logic clearer by doing more in I also added more test coverage, including for #174 to show that it is indeed fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @minrk!!!
Thanks for your thoughtful review! |
useChartVersion
and change appended version suffix (now like 1.2.3-0.dev.git.3.h123
)useChartVersion
and change appended version suffix (now like 1.2.3-0.dev.git.3.h123
)
Instead of
1.2.3-n003.habc
produce1.2.3-0.dev.git.3.habc
Problem
Our current dev versions don't sort correctly for various reasons:
n999
andn1000
sort alphabetically, resulting in incorrect ordering1.2.3
>1.2.3-n003.habc
, when it should be the other way around) unless repos publish a prerelease tag immediately after every stable releaseThe only way to get prereleases to sort correctly is to produce them relative to the next release, not the previous release, which we get from
git describe
.Plus, the version information is misleading - there's no indication of whether a dev version is preparing for a minor release or a major one - only that it's after some version in the past.
Proposal
n012
zero-padded text fields for commit count. New tag scheme appends.git.{n}.h{sha}
to prereleases (e.g.1.2.3-alpha.1
->1.2.3-alpha.1.git.5.habc
), so commit counts are compared numerically instead of alphabetically.0.dev.
for base prerelease versions, if building a dev version from a non-prerelease version (e.g.1.2.3
->1.2.3-0.dev.git.5.habc
) so that it sorts beforealpha
useChartVersion
to use the version in Chart.yaml as the base version, instead of the most recent git tag.chartpress --reset
resets the version by stripping the.git.{n}.h{sha}
suffix, leaving the base version alone, rather than clobbering with invalidset-by-chartpress
tag.Notably, this does not solve the prerelease < stable release ordering by default, it only allows repos to solve it by opting in to the
useChartVersion
config, and specifying the dev version in Chart.yaml, as is standard practice in software packages (1. tag a release, 2. set version to$next-dev
). I think this is the right approach, becuse the next version is not guessable, so it has to come from the maintaners somehow, either:EDIT: original description
When we added the
n00
prefix, I misunderstood semver restrictions about leading 0s. We can have leading 0s on fields that aren't just digits (e.g.0git
is okay, but05
is not), so the prefix was only strictly necessary on the hash, not the count. And we can have fields that are exactly one 0 (.0.
is okay,.00
is not). So I think then00
prefix was not the best solution -n.5
is better thann005
. It's correctly sortable (n.1000
>n.999
, unliken1000
andn999
), and separates the numerical field from the 'channel' field.Further, once we have two fields, I think we should sort before 'alpha', so that a pre-alpha dev release (1.2.3-$tag) will sort before the following alpha (1.2.3-alpha.$tag). I chose
0git
for this, but I'm not sure that's best. Coud use0.dev.git
To this end, I propose changing our tag scheme from
n{n:03}.h{hash}
to0git.{n}.h{hash}
:0git.
to sort before 'alpha.'Other options:
0git.
prefix, just use numbers. This might be confusing for a version that already has a number, like1.0.0-alpha.1.5.habc
or--long
tags with no commits like1.0.0-0.habc
.0
:1.0.0-alpha.1.0.5.habc
git
orn
- I like these better aesthetically, but they have the problem that they sort afteralpha
andbeta
, so1.2.3-git.5.habc > 1.2.3-alpha.1
closes #174