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

[Feature] Added more information to the version command #688

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

ZeljkoBenovic
Copy link
Contributor

@ZeljkoBenovic ZeljkoBenovic commented Aug 17, 2022

Description

This PR adds more information to the polygon-edge version command.
Now we have the information about the release version , commit hash, git branch and build time.

When compiling polygon-edge binary ( instead of using GitHub releases ), users should use make build command instead of native go build command, as make feeds the required information to the compiler.

If not using make build, users should add --ldflags to the go build command.

go build -o polygon-edge -ldflags="\
      -X 'github.com/0xPolygon/polygon-edge/versioning.Version=$(git describe --tags --abbrev=0)'\
      -X 'github.com/0xPolygon/polygon-edge/versioning.Commit=$(git rev-parse HEAD)'\
      -X 'github.com/0xPolygon/polygon-edge/versioning.Branch=$(git rev-parse --abbrev-ref HEAD | tr -d "\040\011\012\015\n")'\
      -X 'github.com/0xPolygon/polygon-edge/versioning.BuildTime=$(date)'" \
main.go

this will make sure that the correct information is fed to the compiler.

Once compiled the version information should be as following:

[VERSION INFO]
Release version: v0.5.0 
Git branch: feature/include-commit-in-version-cmd
Commit hash: 89fa3a5098398fcc21f6a8eb88dd776b81125255
Build time: Wed Aug 31 21:40:35 CEST 2022

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Build the polygon-edge binary using make build command or with the above instructions, and run polygon-edge version.
You should see release version, commit hash and build time information.

Documentation update

Public that describes build procedure needs to be updated.

Additional comments

Fixes EDGE-746

* Added commit hash info
* Added build timestamp info
* Renamed version to Release version
@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #688 (f3eed73) into develop (74ab62e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop     #688   +/-   ##
========================================
  Coverage    48.81%   48.81%           
========================================
  Files          112      112           
  Lines        15460    15460           
========================================
  Hits          7547     7547           
  Misses        7279     7279           
  Partials       634      634           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@Kourin1996 Kourin1996 left a comment

Choose a reason for hiding this comment

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

Just a small comment

command/version/result.go Outdated Show resolved Hide resolved
@zivkovicmilos zivkovicmilos added this to the 0.6 Release milestone Aug 24, 2022
@ZeljkoBenovic ZeljkoBenovic merged commit f982111 into develop Sep 20, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2022
@zivkovicmilos zivkovicmilos deleted the feature/include-commit-in-version-cmd branch October 11, 2022 12:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants