-
Notifications
You must be signed in to change notification settings - Fork 145
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
[20.10 backport] [deb] fixes for version generating #831
[20.10 backport] [deb] fixes for version generating #831
Conversation
macOS uses the BSD flavor of `date`, which does not support the `--date` option to set a custom time. Previously, we were using an alpine container to provide a GNU flavor of date, which was a bit of a hack. This patch rewrites the script to work on macOS directly, without the need of a container: ./static/gen-static-ver . v1.2.3-dev 0.0.0-20220404154104-b815498 docker run --rm -v $(pwd):/src -w /src golang bash -c './static/gen-static-ver . v1.2.3-dev' 0.0.0-20220404154104-b815498 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 17a21b8) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The script assumed that pre-release suffixes used the format `-tp<number>`, `-beta<number>` or `-rc<number>`, however, it's more common (and standard practice in SemVer) to delimit the `alpha/beta/rc` with a `.`, which allows SemVer comparing to first sort by pre-release version (`alpha`, `beta`, `rc`), then by the numeric suffix. Altogether, we should consider removing this code; using `tp` as a pre-release *before* `alpha` / `beta` is non-standard (pre-releases are named `alpha`, `beta`, `rc`, so that they can be sorted alphabetically. Using `tp` violates that assumption, and adds the complexity of having to add a numeric prefix to make it sort again. Also see https://www.debian.org/doc/debian-policy/ch-controlfields.html#epochs-should-be-used-sparingly Before: ./rpm/gen-rpm-ver . 22.06.0-beta0 22.06.0 1.0.beta0 6e7db7f 22.06.0-beta0 ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0.beta.0 3 6e7db7f 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta0 22.06.0~1.0.beta0 22.06.0-beta0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~beta.0~3 22.06.0-beta.0 After: ./rpm/gen-rpm-ver . 22.06.0-beta0 22.06.0 1.0.beta0 3091da7 22.06.0-beta0 ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0 1.0.beta.0 3091da7 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta0 22.06.0~1.0.beta0 22.06.0-beta0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~1.0.beta.0 22.06.0-beta.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 005f613) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This unifies the logic/code for generating pseudo-versions for nightly builds; - Generate pseudo-version if the source repository has uncommitted changes - Fix code to work on macOS - Strip "v" prefix if the passed VERSION has one Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 538e7f1) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The script had special handling for pre-releases, because at some point we used `-tp` ("technical preview") as suffix for pre-releases instead of the standard `-alpha`, `-beta`, `-rc`. The problem arised because of that, was that comparing versions wouldn't work, as these suffixes are compared in _alphabetical_ order (which meant that `tp` would come "after" `beta` and `rc`). To work around this, some custom code was added to insert a numeric version _before_ the `tp`, `beta`, and `rc`. We no longer plan to use `-tp` for pre-releases, and instead to just use the common `alpha[.number]`, `beta[.number]`, `rc[.number]` suffixes. This patch removes the custom handling for pre-releases, to simplify the version that's generated. Before: ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0 1.0.beta.0 3091da7 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~1.0.beta.0 22.06.0-beta.0 After: ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0~beta.0 1 0b5a1ae 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~beta.0 22.06.0-beta.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit ba44734) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
debVersion="$(gen_deb_version "$debVersion" rc 2)" | ||
;; | ||
*) | ||
debVersion="$debVersion-3" |
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.
Need to make some changes to preserve this ~3
for the 20.10 branch (for now) so that the docker-ce
, docker-ce-cli
, and docker-ce-rootless-extras
packages keep it (23.0.0 will start using the new versioning scheme)
Make sure to continue using the "old" versioning for the 20.10 packages (docker-ce, docker-ce-cli, docker-rootless-extras). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
# Note: on the 20.10 branch, we preserve the "~3" suffix that was removed in | ||
# commit 8a720b28a5d0db8fc93423cca79ca21b9b69f1f1, and continue using the | ||
# old version scheme for docker-ce, docker-ce-cli, and docker-rootless-extras. | ||
cat > "debian/changelog" <<-EOF | ||
$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}-0~${DISTRO}-${SUITE}) $SUITE; urgency=low | ||
$debSource (${EPOCH}${EPOCH_SEP}${DEB_VERSION}~3-0~${DISTRO}-${SUITE}) $SUITE; urgency=low |
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.
Revert the changes from 8a720b2 for the docker-ce packages (but continue using the new format for the plugins, so that we don't push the same version of a plugin twice (once through the 23.0 release, once through the 20.10 release).
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.
Wait, what's the ~3
here for? (Sorry, I'm missing some context 🙈)
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.
This was used in 20.10 (and before) to.. make sure "stable" releases ranked higher than "pre-releases" (:lolsob:
). I removed that code from master, but the same generation code is used for all deb versions, so I backported removing that ugly hack in this PR (see 8a720b2). However, as 20.10 is reaching its end, I didn't want to introduce changing the versioning scheme for it, so I added it back here. As we're not planning to do -beta
releases for 20.10 patch releases, I hardcoded it to ~3
(which was used to designate "stable releases').
# rpmRelease=1 | ||
|
||
# Note: on the 20.10 branch, continue using "3" as default, which was removed in | ||
# commit 8a720b28a5d0db8fc93423cca79ca21b9b69f1f1. 23.0.0 and up use "1" | ||
# as default. | ||
rpmRelease=3 |
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.
Same here, for RPMs
Thx! Let me bring this one in |
Backports: