import "go.chromium.org/luci/cipd/version"
Package version provides a way for CIPD packaged Go binaries to discover their current package instance ID.
It's safe to link this library into arbitrary executables. It is small and doesn't pull in rest of CIPD client code.
GetVersionFile returns the path to the version file corresponding to the provided exe. This isn't typically needed, but can be useful for debugging.
type Info struct { PackageName string `json:"package_name"` InstanceID string `json:"instance_id"` }
Info describes JSON file with package version information that's deployed to a path specified in 'version_file' attribute of the manifest.
GetCurrentVersion reads version file from disk.
Note that it may have been updated since the process started. This function always reads the latest values. Version file is expected to be found at <exe-path>.cipd_version.
Add following lines to package definition yaml to to set this up:
data: - version_file: .versions/<exe-name>${exe_suffix}.cipd_version
Replace <exe-name> with name of the binary file.
If the version file is missing, returns empty Info{} and no error.
GetStartupVersion returns value of version file as it was when the process has just started.
Package version imports 4 packages (graph) and is imported by 22 packages. Updated 2021-01-25. Refresh now. Tools for package owners.