Repository navigation
Add next Docker tag that tracks the latest full release or RC - #20596
MadLittleMods wants to merge 7 commits into
Conversation
| type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }} | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }} | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | ||
| type=raw,value=next,enable=${{ steps.next-tag.outputs.is_next == 'true' }} |
There was a problem hiding this comment.
Opinions on the next tag name?
There was a problem hiding this comment.
I could see it being confusing for some.
Is the latest newer or older than next? It's not immediately obvious, that latest is actually older than next if there is a newer RC available.
Something like staging makes it clear that it shouldn't be considered a stable release.
But also happy to go a different route.
There was a problem hiding this comment.
Tricky. I don't mind which.
prerelease is another idea, which we use for Debian packages (docs) to get RCs, and if you follow the docs you get either the latest main or RC release through apt, i.e. when you have both main and prerelease in your sources.list line.
There was a problem hiding this comment.
prerelease isn't bad. A bit long... 😆 But why should that matter
| # We only need the tag names: skip trees and blobs. | ||
| filter: tree:0 | ||
| sparse-checkout: .github | ||
| # - `versionsort.suffix=rc` makes git sort `v1.2.0rc1` before `v1.2.0`. |
There was a problem hiding this comment.
Docs: https://git-scm.com/docs/git-config#Documentation/git-config.txt-versionsortsuffix
By specifying a single suffix in this variable, any tagname containing that suffix will appear before the corresponding main release. E.g. if the variable is set to "-rc", then all "1.0-rcX" tags will appear before "1.0".
| filter: tree:0 | ||
| sparse-checkout: .github | ||
| # - `versionsort.suffix=rc` makes git sort `v1.2.0rc1` before `v1.2.0`. | ||
| # - `--sort=-v:refname` to get "tag names are treated as versions" |
There was a problem hiding this comment.
Docs: https://git-scm.com/docs/git-tag/2.12.5#Documentation/git-tag.txt---sortkey
Sort based on the key given. Prefix - to sort in descending order of the value. You may use the --sort= option multiple times, in which case the last key becomes the primary key. Also supports "version:refname" or "v:refname" (tag names are treated as versions). The "version:refname" sort order can also be affected by the "versionsort.suffix" configuration variable.
| * `next`: the most recent release, whether a release candidate (RC) or a full release. | ||
| Use this to help test release candidates before they become a full release. It never | ||
| moves backwards, e.g. a patch release for an older version does not replace a newer | ||
| release candidate. |
There was a problem hiding this comment.
Can't tell whether this detail matters here 🤔
| * `next`: the most recent release, whether a release candidate (RC) or a full release. | |
| Use this to help test release candidates before they become a full release. It never | |
| moves backwards, e.g. a patch release for an older version does not replace a newer | |
| release candidate. | |
| * `next`: the most recent release, whether a release candidate (RC) or a full release. | |
| Use this to help test release candidates before they become a full release. |
There was a problem hiding this comment.
It probably shouldn't be here. It's more of an internal note to make sure we don't accidentally let it happen.
For the docs, I wouldn't even question that this was the case.
Plus it's already noted in the dockerfile so we don't lose it altogether.
| --format='%(refname:lstrip=2)' --count=1) | ||
| echo "Newest release: $NEWEST; this build: $GITHUB_REF_NAME" | ||
| echo "is_next=$([ "$NEWEST" = "$GITHUB_REF_NAME" ] && echo true || echo false)" >> "$GITHUB_OUTPUT" | ||
|
|
There was a problem hiding this comment.
Instead of using git for-each-ref, we could also use git ls-remote but it doesn't have any formatting option so we need extra shell garbage to slice and dice things 🤷
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
| run: | | ||
| NEWEST=$(git -c versionsort.suffix=rc for-each-ref 'refs/tags/v*' --sort=-v:refname \ | ||
| --exclude='refs/tags/*[!v0-9.rc]*' \ |
There was a problem hiding this comment.
This glob exclude pattern isn't fool-proof but should be good enough.
There are a few old tags like v0.6.1c that will slip through currently but we're way past that version nowadays so it doesn't come into play.
devonh
left a comment
There was a problem hiding this comment.
Overall everything looks good, it's just a question of the name of the tag now.
Add
nextDocker (container image) tag that tracks the latest full release or RCAs suggested by @wrjlewis in this weeks backend meeting. We're not aware of anyone else asking for this but even it’s just @wrjlewis who likes using it for his own homeserver deployment, it's useful for giving more effort to testing the RC and better protect from regressions 💪 And other people will probably end up using now that it's available.
Dev notes
https://packaging.pypa.io/en/stable/version.html#packaging.version.Version.public
Last time I dealt with Python
packaging.Version: https://github.com/element-hq/synapse-private/pull/223Pull Request Checklist