loop: add the commit_hash to GetInfoResponse, change version semantics

With this commit we extend GetinfoResponse with the strict commit hash
(which also includes whether the build tree was clean or dirty).
This commit is contained in:
Andras Banki-Horvath 2025-04-04 12:32:33 +02:00
parent f72cdde58f
commit 9a6266f9f7
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
7 changed files with 725 additions and 692 deletions

View file

@ -45,13 +45,25 @@ const (
var AgentName = defaultAgentName
// Version returns the application version as a properly formed string per the
// semantic versioning 2.0.0 spec (http://semver.org/) and the commit it was
// built on.
// semantic versioning 2.0.0 spec (http://semver.org/).
func Version() string {
// Append commit hash of current build to version.
return semanticVersion()
}
// RichVersion returns the application version as a properly formed string
// per the semantic versioning 2.0.0 spec (http://semver.org/) and the commit
// it was built on.
func RichVersion() string {
// Append commit hash of current build to version.
return fmt.Sprintf("%s commit=%s", semanticVersion(), Commit)
}
// CommitHash returns the commit hash of the current build.
func CommitHash() string {
return Commit
}
// UserAgent returns the full user agent string that identifies the software
// that is submitting swaps to the loop server.
func UserAgent(initiator string) string {