Add release cycle to versioning of Flamenco
Include `RELEASE_CYCLE` in the Makefile. This is mentioned at startup of Manager and Worker, and reflects in the software version they report. If `RELEASE_CYCLE == "release"`, Manager and Worker report their version as `ApplicationVersion`. If it's any other string, the Git hash will get appended.
This commit is contained in:
parent
8c86d4c1a9
commit
d4dfa2d071
5
Makefile
5
Makefile
@ -3,9 +3,12 @@ PKG := git.blender.org/flamenco
|
||||
# To update the version number in all the relevant places, update the VERSION
|
||||
# variable below and run `make update-version`.
|
||||
VERSION := 3.0-dev0
|
||||
RELEASE_CYCLE := alpha
|
||||
|
||||
GITHASH := $(shell git describe --dirty --always)
|
||||
LDFLAGS := -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} -X ${PKG}/internal/appinfo.ApplicationGitHash=${GITHASH}
|
||||
LDFLAGS := -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} \
|
||||
-X ${PKG}/internal/appinfo.ApplicationGitHash=${GITHASH} \
|
||||
-X ${PKG}/internal/appinfo.ReleaseCycle=${RELEASE_CYCLE}
|
||||
BUILD_FLAGS = -ldflags="${LDFLAGS}"
|
||||
|
||||
# Package name of the generated Python/JavaScript code for the Flamenco API.
|
||||
|
@ -73,6 +73,7 @@ func main() {
|
||||
log.Info().
|
||||
Str("version", appinfo.ApplicationVersion).
|
||||
Str("git", appinfo.ApplicationGitHash).
|
||||
Str("releaseCycle", appinfo.ReleaseCycle).
|
||||
Str("os", runtime.GOOS).
|
||||
Str("arch", runtime.GOARCH).
|
||||
Msgf("starting %v", appinfo.ApplicationName)
|
||||
|
@ -63,6 +63,7 @@ func main() {
|
||||
log.Info().
|
||||
Str("version", appinfo.ApplicationVersion).
|
||||
Str("git", appinfo.ApplicationGitHash).
|
||||
Str("releaseCycle", appinfo.ReleaseCycle).
|
||||
Str("OS", runtime.GOOS).
|
||||
Str("ARCH", runtime.GOARCH).
|
||||
Int("pid", os.Getpid()).
|
||||
|
@ -15,6 +15,17 @@ var ApplicationVersion = "set-during-build"
|
||||
// It is set during the build.
|
||||
var ApplicationGitHash = "set-during-build"
|
||||
|
||||
// ReleaseCycle determines whether this is marked as release or whether it's
|
||||
// an development version. This is used to determine wehtehr ExtendedVersion()
|
||||
// actually returns just the version ("release") or also has the Git hash
|
||||
// (any other string).
|
||||
//
|
||||
// This is a string and not a boolean, because it must be set by the linker and
|
||||
// that only supports strings.
|
||||
var ReleaseCycle string = "set-during-build"
|
||||
|
||||
const releaseCycleRelease = "release"
|
||||
|
||||
// FormattedApplicationInfo returns the application name & version as single string.
|
||||
func FormattedApplicationInfo() string {
|
||||
return fmt.Sprintf("%s %s", ApplicationName, ApplicationVersion)
|
||||
@ -24,3 +35,13 @@ func FormattedApplicationInfo() string {
|
||||
func UserAgent() string {
|
||||
return fmt.Sprintf("%s/%s (%s)", ApplicationName, ApplicationVersion, ApplicationGitHash)
|
||||
}
|
||||
|
||||
// ExtendedVersion returns the application version, and includes the Git hash if
|
||||
// this is not a release version. See `IsReleaseVersion`.
|
||||
func ExtendedVersion() string {
|
||||
if ReleaseCycle == releaseCycleRelease {
|
||||
return ApplicationVersion
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s-%s", ApplicationVersion, ApplicationGitHash)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
|
||||
func (f *Flamenco) GetVersion(e echo.Context) error {
|
||||
return e.JSON(http.StatusOK, api.FlamencoVersion{
|
||||
Version: appinfo.ApplicationVersion,
|
||||
Version: appinfo.ExtendedVersion(),
|
||||
Name: appinfo.ApplicationName,
|
||||
})
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ func signOn(ctx context.Context, cfg WorkerConfig, client FlamencoClient) (api.W
|
||||
req := api.SignOnJSONRequestBody{
|
||||
Name: workerName(),
|
||||
SupportedTaskTypes: cfg.TaskTypes,
|
||||
SoftwareVersion: appinfo.ApplicationVersion,
|
||||
SoftwareVersion: appinfo.ExtendedVersion(),
|
||||
}
|
||||
|
||||
logger.Info().
|
||||
|
Loading…
x
Reference in New Issue
Block a user