Skip to content

feat: Add buildinfo package to embed version #840

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
merged 1 commit into from
Apr 5, 2022
Merged

feat: Add buildinfo package to embed version #840

merged 1 commit into from
Apr 5, 2022

Conversation

kylecarbs
Copy link
Member

@kylecarbs kylecarbs commented Apr 3, 2022

This also resolves build time and commit hash using the
Go 1.18 debug/buildinfo package. An external URL is outputted
on running version as well to easily route the caller to a
release or commit.

Closes #493.

# dev
m ~/P/c/coder (version *s) go run ./cmd/coder -v
Coder v0.0.0-devel+1003b0f Sun Apr  3 20:37:27 UTC 2022
https://github.com/coder/coder/commit/1003b0fe5a3d41fb4626c7efb6b45c1edefcb67d

# prod
m ~/P/c/coder (version s) ./dist/coder-slim_linux_amd64/coder -v
Coder v0.3.4+1003b0f Sun Apr  3 20:37:27 UTC 2022
https://github.com/coder/coder/commit/1003b0fe5a3d41fb4626c7efb6b45c1edefcb67d

@kylecarbs kylecarbs requested a review from coadler April 3, 2022 20:37
@kylecarbs kylecarbs self-assigned this Apr 3, 2022
@codecov
Copy link

codecov bot commented Apr 3, 2022

Codecov Report

Merging #840 (5e22769) into main (ccba2ba) will decrease coverage by 0.26%.
The diff coverage is 59.61%.

@@            Coverage Diff             @@
##             main     #840      +/-   ##
==========================================
- Coverage   66.06%   65.80%   -0.27%     
==========================================
  Files         202      205       +3     
  Lines       13209    13309     +100     
  Branches       87       87              
==========================================
+ Hits         8727     8758      +31     
- Misses       3600     3655      +55     
- Partials      882      896      +14     
Flag Coverage Δ
unittest-go- 65.20% <59.61%> (-0.26%) ⬇️
unittest-go-macos-latest 52.57% <59.61%> (+0.10%) ⬆️
unittest-go-ubuntu-latest 55.20% <59.61%> (+0.26%) ⬆️
unittest-go-windows-2022 51.91% <59.61%> (+0.21%) ⬆️
unittest-js 62.36% <ø> (-0.28%) ⬇️
Impacted Files Coverage Δ
cli/buildinfo/buildinfo.go 56.09% <56.09%> (ø)
cli/root.go 76.41% <72.72%> (-0.43%) ⬇️
codersdk/provisionerdaemons.go 58.46% <0.00%> (-6.16%) ⬇️
coderd/provisionerdaemons.go 58.51% <0.00%> (-4.56%) ⬇️
provisioner/echo/serve.go 56.80% <0.00%> (-2.41%) ⬇️
coderd/parameter/compute.go 74.07% <0.00%> (-2.23%) ⬇️
provisionerd/provisionerd.go 80.32% <0.00%> (-1.18%) ⬇️
coderd/database/queries.sql.go 83.30% <0.00%> (-0.23%) ⬇️
site/src/Main.tsx 0.00% <0.00%> (ø)
coderd/autostart/schedule/schedule.go 83.33% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccba2ba...5e22769. Read the comment docs.

if !valid {
return repo
}
return repo + "/commit/" + revision
Copy link
Contributor

Choose a reason for hiding this comment

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

path.Join might make this a bit cleaner!

This also resolves build time and commit hash using the
Go 1.18 debug/buildinfo package. An external URL is outputted
on running version as well to easily route the caller to a
release or commit.
@kylecarbs kylecarbs enabled auto-merge (squash) April 5, 2022 01:31
@kylecarbs kylecarbs merged commit 5ae71f0 into main Apr 5, 2022
@kylecarbs kylecarbs deleted the version branch April 5, 2022 01:35
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.

Embed version in CLI
2 participants