Skip to content

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

Merged

Conversation

smarterclayton
Copy link
Contributor

@smarterclayton smarterclayton commented Apr 22, 2016

Handles v1.2.0-rc1-5-g3549834 correctly

Unblock local dev [merge]

Fixes #8609

Handles v1.2.0-rc1-5-g3549834 correctly
@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5663/) (Image: devenv-rhel7_4015)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 8b53096

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3196/)

@smarterclayton
Copy link
Contributor Author

Flake #8589

@smarterclayton
Copy link
Contributor Author

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 8b53096

@openshift-bot openshift-bot merged commit 6a28255 into openshift:master Apr 22, 2016
@marun
Copy link
Contributor

marun commented Apr 22, 2016

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
Copy link
Contributor

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.

@smarterclayton
Copy link
Contributor Author

smarterclayton commented Apr 22, 2016 via email

@marun
Copy link
Contributor

marun commented Apr 22, 2016

Yikes. What prevents this class of error from recurring then?

}

return strings.Join(parts, "-")
}
Copy link
Member

@sdodson sdodson Apr 25, 2016

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

Copy link
Contributor Author

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

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.

4 participants