Documentation ¶
Overview ¶
Package version provides information about what Bacalhau was built from.
The bulk of the information comes from the debug.BuildInfo struct which gets automatically populated when building a binary as a Go module (`go build .` vs `go build main.go`) with Go 1.18+. It contains various things such as VCS information or dependencies.
Index ¶
- Constants
- Variables
- func Get() *models.BuildVersionInfo
- func IsVersionExplicit(clientVersionStr string) bool
- func LogUpdateResponse(ctx context.Context, ucr *UpdateCheckResponse)
- func RunUpdateChecker(ctx context.Context, cfg types.Bacalhau, store UpdateStore, ...)
- type UpdateCheckResponse
- type UpdateStore
Constants ¶
const DevelopmentGitVersion = "v0.0.0-xxxxxxx"
const UnknownGitVersion = "v0.0.0"
Variables ¶
var ( Development = semver.MustParse(DevelopmentGitVersion) Unknown = semver.MustParse(UnknownGitVersion) )
var ( // GITVERSION is the Git tag that Bacalhau was built from. This is expected to be populated via the `ldflags` flag, // at least until https://github.com/golang/go/issues/50603 is fixed. The value shown here will be used when the // value isn't provided by ldflags. // // A good article on how to use buildflags is // https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications. GITVERSION = DevelopmentGitVersion )
Functions ¶
func Get ¶
func Get() *models.BuildVersionInfo
Get returns the overall codebase version. It's for detecting what code a binary was built from.
func IsVersionExplicit ¶ added in v1.5.0
IsVersionExplicit checks if the client version is a specific, known version. It returns false for empty, development, or unknown versions.
func LogUpdateResponse ¶ added in v1.1.2
func LogUpdateResponse(ctx context.Context, ucr *UpdateCheckResponse)
func RunUpdateChecker ¶ added in v1.1.2
func RunUpdateChecker( ctx context.Context, cfg types.Bacalhau, store UpdateStore, getServerVersion func(context.Context) (*models.BuildVersionInfo, error), responseCallback func(context.Context, *UpdateCheckResponse), )
RunUpdateChecker starts a goroutine that will periodically make an update check according to the configured update frequency and check skipping. The goroutine is ended by canceling the passed context. `getServerVersion` is allowed to return a nil version if there is no server to communicate with (e.g. because the node running the update check is the server).
Types ¶
type UpdateCheckResponse ¶ added in v1.1.2
type UpdateCheckResponse struct { Version *models.BuildVersionInfo `json:"version"` Message string `json:"message"` }
func CheckForUpdate ¶ added in v1.1.2
func CheckForUpdate( ctx context.Context, currentClientVersion, currentServerVersion *models.BuildVersionInfo, instanceID string, ) (*UpdateCheckResponse, error)