diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a7e9065f2..78da27548 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -27,8 +27,6 @@ values = [bumpversion:file:internal/constants/constants.go] -[bumpversion:file:internal/outpost/version.go] - [bumpversion:file:web/src/constants.ts] [bumpversion:file:website/docs/outposts/manual-deploy-docker-compose.md] diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 966bbd646..fdc4942ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,7 @@ updates: assignees: - BeryJu - package-ecosystem: gomod - directory: "/outpost" + directory: "/" schedule: interval: daily time: "04:00" @@ -48,11 +48,3 @@ updates: open-pull-requests-limit: 10 assignees: - BeryJu -- package-ecosystem: docker - directory: "/outpost" - schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - assignees: - - BeryJu diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 493c21ea2..e83d74157 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -1,3 +1,20 @@ package constants +import ( + "fmt" + "os" +) + const VERSION = "2021.6.1-rc6" + +func BUILD() string { + build := os.Getenv("GIT_BUILD_HASH") + if build == "" { + return "tagged" + } + return build +} + +func OutpostUserAgent() string { + return fmt.Sprintf("authentik-outpost@%s (%s)", VERSION, BUILD()) +} diff --git a/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index d73861cec..176534b36 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -13,7 +13,7 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" "github.com/recws-org/recws" - pkg "goauthentik.io/internal/outpost" + "goauthentik.io/internal/constants" "goauthentik.io/outpost/api" log "github.com/sirupsen/logrus" @@ -44,7 +44,7 @@ func NewAPIController(akURL url.URL, token string) *APIController { config.Host = akURL.Host config.Scheme = akURL.Scheme config.HTTPClient = &http.Client{ - Transport: SetUserAgent(GetTLSTransport(), pkg.UserAgent()), + Transport: SetUserAgent(GetTLSTransport(), constants.OutpostUserAgent()), } config.AddDefaultHeader("Authorization", fmt.Sprintf("Bearer %s", token)) diff --git a/internal/outpost/ak/api_ws.go b/internal/outpost/ak/api_ws.go index 50ec33acd..68f8011f1 100644 --- a/internal/outpost/ak/api_ws.go +++ b/internal/outpost/ak/api_ws.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/gorilla/websocket" "github.com/recws-org/recws" - pkg "goauthentik.io/internal/outpost" + "goauthentik.io/internal/constants" ) func (ac *APIController) initWS(akURL url.URL, outpostUUID strfmt.UUID) { @@ -23,7 +23,7 @@ func (ac *APIController) initWS(akURL url.URL, outpostUUID strfmt.UUID) { header := http.Header{ "Authorization": []string{authHeader}, - "User-Agent": []string{pkg.UserAgent()}, + "User-Agent": []string{constants.OutpostUserAgent()}, } value, set := os.LookupEnv("AUTHENTIK_INSECURE") @@ -46,8 +46,8 @@ func (ac *APIController) initWS(akURL url.URL, outpostUUID strfmt.UUID) { msg := websocketMessage{ Instruction: WebsocketInstructionHello, Args: map[string]interface{}{ - "version": pkg.VERSION, - "buildHash": pkg.BUILD(), + "version": constants.VERSION, + "buildHash": constants.BUILD(), "uuid": ac.instanceUUID.String(), }, } @@ -101,8 +101,8 @@ func (ac *APIController) startWSHealth() { aliveMsg := websocketMessage{ Instruction: WebsocketInstructionHello, Args: map[string]interface{}{ - "version": pkg.VERSION, - "buildHash": pkg.BUILD(), + "version": constants.VERSION, + "buildHash": constants.BUILD(), "uuid": ac.instanceUUID.String(), }, } diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 31dfaf119..c2d90d1c1 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -9,7 +9,7 @@ import ( "github.com/getsentry/sentry-go" httptransport "github.com/go-openapi/runtime/client" log "github.com/sirupsen/logrus" - pkg "goauthentik.io/internal/outpost" + "goauthentik.io/internal/constants" ) func doGlobalSetup(config map[string]interface{}) { @@ -33,7 +33,7 @@ func doGlobalSetup(config map[string]interface{}) { default: log.SetLevel(log.DebugLevel) } - log.WithField("buildHash", pkg.BUILD()).WithField("version", pkg.VERSION).Info("Starting authentik outpost") + log.WithField("buildHash", constants.BUILD()).WithField("version", constants.VERSION).Info("Starting authentik outpost") var dsn string if config[ConfigErrorReportingEnabled].(bool) { diff --git a/internal/outpost/ldap/instance_bind.go b/internal/outpost/ldap/instance_bind.go index e75b2ec92..435bb8ae5 100644 --- a/internal/outpost/ldap/instance_bind.go +++ b/internal/outpost/ldap/instance_bind.go @@ -13,7 +13,7 @@ import ( goldap "github.com/go-ldap/ldap/v3" "github.com/nmcclain/ldap" - pkg "goauthentik.io/internal/outpost" + "goauthentik.io/internal/constants" "goauthentik.io/internal/outpost/ak" "goauthentik.io/outpost/api" ) @@ -56,7 +56,7 @@ func (pi *ProviderInstance) Bind(username string, bindDN, bindPW string, conn ne config.Scheme = pi.s.ac.Client.GetConfig().Scheme config.HTTPClient = &http.Client{ Jar: jar, - Transport: newTransport(ak.SetUserAgent(ak.GetTLSTransport(), pkg.UserAgent()), map[string]string{ + Transport: newTransport(ak.SetUserAgent(ak.GetTLSTransport(), constants.OutpostUserAgent()), map[string]string{ "X-authentik-remote-ip": host, }), } diff --git a/internal/outpost/version.go b/internal/outpost/version.go deleted file mode 100644 index d3f886517..000000000 --- a/internal/outpost/version.go +++ /dev/null @@ -1,20 +0,0 @@ -package pkg - -import ( - "fmt" - "os" -) - -const VERSION = "2021.6.1-rc6" - -func BUILD() string { - build := os.Getenv("GIT_BUILD_HASH") - if build == "" { - return "tagged" - } - return build -} - -func UserAgent() string { - return fmt.Sprintf("authentik-outpost@%s (%s)", VERSION, BUILD()) -}