diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 0adcde8f2..af7f68e66 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -5,16 +5,24 @@ import ( "os" ) -func BUILD() string { +func BUILD(def string) string { build := os.Getenv("GIT_BUILD_HASH") if build == "" { - return "tagged" + return def } return build } +func FullVersion() string { + ver := VERSION + if b := BUILD(""); b != "" { + ver = fmt.Sprintf("%s.%s", ver, b) + } + return ver +} + func OutpostUserAgent() string { - return fmt.Sprintf("authentik-outpost@%s (build=%s)", VERSION, BUILD()) + return fmt.Sprintf("authentik-outpost@%s", FullVersion()) } const VERSION = "2021.12.5" diff --git a/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index c6812a536..48a926831 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -171,7 +171,7 @@ func (a *APIController) StartBackgorundTasks() error { "outpost_type": a.Server.Type(), "uuid": a.instanceUUID.String(), "version": constants.VERSION, - "build": constants.BUILD(), + "build": constants.BUILD("tagged"), }).Set(1) go func() { a.logger.Debug("Starting WS Handler...") diff --git a/internal/outpost/ak/api_ws.go b/internal/outpost/ak/api_ws.go index e67ec90ad..2cb084a62 100644 --- a/internal/outpost/ak/api_ws.go +++ b/internal/outpost/ak/api_ws.go @@ -51,7 +51,7 @@ func (ac *APIController) initWS(akURL url.URL, outpostUUID string) error { Instruction: WebsocketInstructionHello, Args: map[string]interface{}{ "version": constants.VERSION, - "buildHash": constants.BUILD(), + "buildHash": constants.BUILD("tagged"), "uuid": ac.instanceUUID.String(), }, } @@ -151,7 +151,7 @@ func (ac *APIController) startWSHandler() { "outpost_type": ac.Server.Type(), "uuid": ac.instanceUUID.String(), "version": constants.VERSION, - "build": constants.BUILD(), + "build": constants.BUILD("tagged"), }).SetToCurrentTime() } } @@ -165,7 +165,7 @@ func (ac *APIController) startWSHealth() { Instruction: WebsocketInstructionHello, Args: map[string]interface{}{ "version": constants.VERSION, - "buildHash": constants.BUILD(), + "buildHash": constants.BUILD("tagged"), "uuid": ac.instanceUUID.String(), }, } @@ -205,7 +205,7 @@ func (ac *APIController) startIntervalUpdater() { "outpost_type": ac.Server.Type(), "uuid": ac.instanceUUID.String(), "version": constants.VERSION, - "build": constants.BUILD(), + "build": constants.BUILD("tagged"), }).SetToCurrentTime() } } diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 495c487e1..7a290a271 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -34,7 +34,7 @@ func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { } else { l.Debug("Managed outpost, not setting global log level") } - l.WithField("hash", constants.BUILD()).WithField("version", constants.VERSION).Info("Starting authentik outpost") + l.WithField("hash", constants.BUILD("tagged")).WithField("version", constants.VERSION).Info("Starting authentik outpost") if globalConfig.ErrorReporting.Enabled { dsn := "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8" diff --git a/internal/outpost/ldap/instance.go b/internal/outpost/ldap/instance.go index 1e1d40a4b..606f476f2 100644 --- a/internal/outpost/ldap/instance.go +++ b/internal/outpost/ldap/instance.go @@ -124,7 +124,7 @@ func (pi *ProviderInstance) GetBaseEntry() *ldap.Entry { }, { Name: "vendorVersion", - Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s (build %s)", constants.VERSION, constants.BUILD())}, + Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())}, }, }, } diff --git a/internal/outpost/ldap/search/direct/base.go b/internal/outpost/ldap/search/direct/base.go index 5688a69d8..6278ab6ab 100644 --- a/internal/outpost/ldap/search/direct/base.go +++ b/internal/outpost/ldap/search/direct/base.go @@ -44,7 +44,7 @@ func (ds *DirectSearcher) SearchBase(req *search.Request, authz bool) (ldap.Serv }, { Name: "vendorVersion", - Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s (build %s)", constants.VERSION, constants.BUILD())}, + Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())}, }, }, }, diff --git a/website/docs/providers/proxy/proxy.md b/website/docs/providers/proxy/proxy.md index f92899b8b..c415ff6c6 100644 --- a/website/docs/providers/proxy/proxy.md +++ b/website/docs/providers/proxy/proxy.md @@ -42,7 +42,7 @@ Besides these user-specific headers, some application specific headers are also The authentik application's slug. -- X-authentik-meta-version: `authentik-outpost@1.2.3 (build=tagged)` +- X-authentik-meta-version: `authentik-outpost@1.2.3` The authentik outpost's version.