Skip to content
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

docker: handle versions generated with git describe --tags --long #3541

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

kd7lxl
Copy link
Contributor

@kd7lxl kd7lxl commented Apr 21, 2021

In #3539 I noted that I wanted to be able to upgrade docker version tags formatted with git describe --tags --long. The format for this is <latest tag>-<number of commits since tag>-g<commit sha>, meaning the first two parts are sortable and the last part should be ignored.

The docker updater has special handling for commit shas, but it doesn't seem to be needed. To make my case work, I removed the line that filters out tags with commit shas: reject { |tag| commit_sha_suffix?(tag) }. Surprisingly, this didn't break any test cases. Please review this thoroughly!

numeric_from_version() discards commit shas before comparison, so it's safe to leave tags with commits shas in the candidate_tags set:

(byebug) version
"v3.9.0-177-ged5bcde"
(byebug) numeric_version_from(version)
"3.9.0-177"

In this PR, I've changed the comparable_tags_from_registry to select tags that look like a commit sha, since they will be discarded later by numeric_from_version. This adds support for upgrading from tags like v3.9.0-177-ged5bcde to v3.10.0-169-gfe040d3.

Fixes #3539

@kd7lxl kd7lxl requested a review from a team as a code owner April 21, 2021 23:32
Copy link
Contributor

@thepwagner thepwagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one idea for extending the test case (but making the change locally - the test still passes so it is potentially moot).

@thepwagner thepwagner self-assigned this Apr 29, 2021
@thepwagner thepwagner merged commit 3fce13b into dependabot:main Apr 29, 2021
@thepwagner thepwagner mentioned this pull request Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker: not able to upgrade tags formatted with git describe --tags --long
3 participants