-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Improve parsing of semantic version for git tag #8608
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
Improve parsing of semantic version for git tag #8608
Conversation
Handles v1.2.0-rc1-5-g3549834 correctly
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5663/) (Image: devenv-rhel7_4015) |
Evaluated for origin merge up to 8b53096 |
[Test]ing while waiting on the merge queue |
continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3196/) |
Flake #8589 |
[test] |
Evaluated for origin test up to 8b53096 |
This PR fixed the bug introduced by #8592. The bug was detected post-merge by the networking job, hopefully we can follow up next week to enable pre-merge? |
reCommitIncrement = regexp.MustCompile(`^[0-9a-f]+$`) | ||
) | ||
|
||
// LastSemanticVersion attempts to return a semantic version from the GitVersion - which |
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.
Consider adding a unit test to prevent regression.
It was only detected on the commit after the release - because we
don't generate tags the same between a release tag and an incremental
tag.
|
Yikes. What prevents this class of error from recurring then? |
} | ||
|
||
return strings.Join(parts, "-") | ||
} |
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.
Is it safe to assume that if we were to split on '-' we'd only include at most the first two parts in the image tag?
v1.1.6 -> v1.1.6
v1.2.0-rc1-17-g642f0af -> v1.2.0-rc1
v1.2.0-rc1 -> v1.2.0-rc1
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.
We have not used more than two semantic parts so far. The possible values
passed to GitVersion are:
v1.1.6
v1.1.6-16-g3498340
v1.1.6-rc1
v1.1.6-rc1-16-g3498340
On Mon, Apr 25, 2016 at 3:49 PM, Scott Dodson [email protected]
wrote:
In pkg/version/version.go
#8608 (comment):
- parts := strings.Split(version, "-")
- // strip the modifier
- if len(parts) > 1 && parts[len(parts)-1] == "dirty" {
parts = parts[:len(parts)-1]
- }
- // strip the Git commit
- if len(parts) > 1 && reCommitSegment.MatchString(parts[len(parts)-1]) {
parts = parts[:len(parts)-1]
// strip a version increment, but only if we found the commit
if len(parts) > 1 && reCommitIncrement.MatchString(parts[len(parts)-1]) {
parts = parts[:len(parts)-1]
}
- }
- return strings.Join(parts, "-")
+}Is it safe to assume that if we were to split on '-' we'd only include at
most the first two parts in the image tag?
v1.1.6 -> v1.1.6
v1.2.0-rc1-17-g642f0af -> v1.2.0-rc1—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/8608/files/8b5309663381ce4cf5cdaaeb737d4d8c7d7f4a0d#r60976326
Handles v1.2.0-rc1-5-g3549834 correctly
Unblock local dev [merge]
Fixes #8609