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

cmd/version: Commit hash #3327

Merged
merged 2 commits into from
Sep 8, 2023
Merged

cmd/version: Commit hash #3327

merged 2 commits into from
Sep 8, 2023

Conversation

codebien
Copy link
Contributor

@codebien codebien commented Sep 7, 2023

What?

Before we were injecting the version details via ldflags. go1.18 introduced the ability to detect the commit directly from the code.

An example of the new format:

k6 v0.46.0 (commit/a7aa07c26b, go1.21.0, linux/amd64)

Why?

We benefit from it for simplifying our build process and making it more reproducible. It now prints the commit hash instead of the timestamp, in this way should be easier to use in case of troubleshooting and reports.

Related PR(s)/Issue(s)

The original discussion where it started #3322 (comment)

@codebien codebien self-assigned this Sep 7, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2023

Codecov Report

Patch coverage: 31.81% and project coverage change: -0.19% ⚠️

Comparison is base (bec53bf) 73.20% compared to head (8465052) 73.01%.
Report is 1 commits behind head on master.

❗ Current head 8465052 differs from pull request most recent head 454aa3d. Consider uploading reports for the commit 454aa3d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3327      +/-   ##
==========================================
- Coverage   73.20%   73.01%   -0.19%     
==========================================
  Files         258      256       -2     
  Lines       19895    19910      +15     
==========================================
- Hits        14564    14538      -26     
- Misses       4406     4439      +33     
- Partials      925      933       +8     
Flag Coverage Δ
ubuntu ?
windows 73.01% <31.81%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
lib/consts/consts.go 51.61% <31.81%> (-26.96%) ⬇️

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@codebien codebien changed the title WIP: readbuildinfo.revision cmd/version: Commit hash Sep 8, 2023
@codebien codebien force-pushed the go-readbuildinfo branch 2 times, most recently from 29f7aeb to 87e8a3a Compare September 8, 2023 09:52
@codebien codebien added this to the v0.47.0 milestone Sep 8, 2023
@codebien codebien requested review from a team, oleiade, olegbespalov and mstoykov and removed request for a team and olegbespalov September 8, 2023 10:13
@codebien codebien marked this pull request as ready for review September 8, 2023 10:13
)
for _, s := range buildInfo.Settings {
switch s.Key {
case "vcs.revision":
Copy link
Contributor

Choose a reason for hiding this comment

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

We even have vcs.time so ... I guess we can even add that if somebody wants 🤷

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

This is awesome 👍🏻

@codebien codebien merged commit c944ebf into master Sep 8, 2023
21 checks passed
@codebien codebien deleted the go-readbuildinfo branch September 8, 2023 13:14
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