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

Add build info to logs #403

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

ronensc
Copy link
Contributor

@ronensc ronensc commented Nov 13, 2023

Issue link

What changes have been made

This PR adds a log line with the build version and build date of the CFO.
Knowing the build version and build date is useful when debugging historical logs and correlating them with the actual code that produced them.

build version format:

<tag>[-<sha>][-dirty]

<tag>: The name of the most recent tag (stripping the prefix 'v')
<sha>: If HEAD is not pointed to a tag, then the hash of HEAD is added.
dirty: If the repository contains any changes, "-dirty" is added.

Note: Once approved, I think it will be beneficial to add a similar PR to MCAD and will be happy to do that.

Verification steps

Build and run:

make build && ./bin/manager

The first log line should look like:

2023-11-13T17:27:45+02:00       INFO    setup   Build info      {"version": "1.0.0-7991ad5", "date": "2023-11-13 17:27"}

Running without make build should yield:

$ go run main.go
2023-11-13T17:53:52+02:00       INFO    setup   Build info      {"version": "UNKNOWN", "date": "UNKNOWN"}

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@ronensc
Copy link
Contributor Author

ronensc commented Nov 13, 2023

cc @eranra @rachelt44

main.go Outdated Show resolved Hide resolved
@astefanutti
Copy link
Contributor

/lgtm

@astefanutti
Copy link
Contributor

/approve

Copy link

openshift-ci bot commented Nov 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astefanutti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 32c6671 into project-codeflare:main Nov 14, 2023
6 checks passed
@ronensc ronensc deleted the build-info branch November 14, 2023 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants