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

feat: add version pkg for Vela #112

Merged
merged 4 commits into from
Oct 19, 2020
Merged

feat: add version pkg for Vela #112

merged 4 commits into from
Oct 19, 2020

Conversation

jbrockopp
Copy link
Contributor

@jbrockopp jbrockopp commented Oct 15, 2020

Implementing a custom Version type for Vela that can be referenced throughout the different repos.

When rendered as JSON the output looks like:

{
  "canonical": "v1.2.3",
  "major": 1,
  "minor": 2,
  "patch": 3,
  "metadata": {
    "architecture": "amd64",
    "build_date": "1970-1-1T00:00:00Z",
    "compiler": "gc",
    "git_commit": "abcdef123456789",
    "go_version": "1.15.0",
    "operating_system": "linux"
  }
}

Beyond the String() functions, this package also supports two different functions:

  • Meta() - returns only the metadata surrounding the version of the application
  • Semantic() - returns only the canonical semantic version of the application

@jbrockopp jbrockopp added the feature Indicates a new feature label Oct 15, 2020
@jbrockopp jbrockopp self-assigned this Oct 15, 2020
@codecov
Copy link

codecov bot commented Oct 15, 2020

Codecov Report

Merging #112 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #112   +/-   ##
=======================================
  Coverage   99.20%   99.20%           
=======================================
  Files          46       48    +2     
  Lines        2759     2784   +25     
=======================================
+ Hits         2737     2762   +25     
  Misses         12       12           
  Partials       10       10           
Impacted Files Coverage Δ
version/metadata.go 100.00% <100.00%> (ø)
version/version.go 100.00% <100.00%> (ø)

@jbrockopp jbrockopp marked this pull request as ready for review October 15, 2020 19:30
@jbrockopp jbrockopp requested a review from a team as a code owner October 15, 2020 19:30
@jbrockopp jbrockopp marked this pull request as draft October 15, 2020 19:48
@jbrockopp jbrockopp marked this pull request as ready for review October 16, 2020 13:32
@jbrockopp jbrockopp changed the title feat: add version type for Vela feat: add version pkg for Vela Oct 16, 2020
GitCommit: %s,
GoVersion: %s,
OperatingSystem: %s,
}`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the format if we were to output the Metadata from the struct.

GoVersion: %s,
OperatingSystem: %s,
}
}`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the format if we were to output the entire Version struct.

// Meta implements a formatted string containing only metadata for the Version type.
func (v *Version) Meta() string {
return v.Metadata.String()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the function used to return only the Metadata from the version.

// Semantic implements a formatted string containing a formal semantic version for the Version type.
func (v *Version) Semantic() string {
return v.Canonical
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the function used to return only the canonical reference of the semantic version.

Copy link

@kneal kneal left a comment

Choose a reason for hiding this comment

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

LGTM 🐬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Indicates a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants