From 80914752d56fa5729857e26f9d853c091aa888d2 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 15 Sep 2021 16:35:35 +0200 Subject: [PATCH] fix: set version during release build and register version handler (#714) --- .goreleaser.yml | 10 +++++----- internal/driver/registry_default.go | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 7146af83b..8c99b98aa 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -17,7 +17,7 @@ builds: - -tags - sqlite ldflags: - - -s -w -X github.com/ory/keto/driver/config.Version={{.Tag}} -X github.com/ory/keto/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/driver/config.Date={{.Date}} + - -s -w -X github.com/ory/keto/internal/driver/config.Version={{.Tag}} -X github.com/ory/keto/internal/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/internal/driver/config.Date={{.Date}} # - "-extldflags '-static'" binary: keto env: @@ -35,7 +35,7 @@ builds: - -tags - sqlite ldflags: - - -s -w -X github.com/ory/keto/driver/config.Version={{.Tag}} -X github.com/ory/keto/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/driver/config.Date={{.Date}} + - -s -w -X github.com/ory/keto/internal/driver/config.Version={{.Tag}} -X github.com/ory/keto/internal/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/internal/driver/config.Date={{.Date}} binary: keto env: - CGO_ENABLED=1 @@ -49,7 +49,7 @@ builds: - -tags - sqlite ldflags: - - -s -w -X github.com/ory/keto/driver/config.Version={{.Tag}} -X github.com/ory/keto/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/driver/config.Date={{.Date}} + - -s -w -X github.com/ory/keto/internal/driver/config.Version={{.Tag}} -X github.com/ory/keto/internal/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/internal/driver/config.Date={{.Date}} binary: keto env: - CGO_ENABLED=1 @@ -64,7 +64,7 @@ builds: - -tags - sqlite ldflags: - - -s -w -X github.com/ory/keto/driver/config.Version={{.Tag}} -X github.com/ory/keto/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/driver/config.Date={{.Date}} + - -s -w -X github.com/ory/keto/internal/driver/config.Version={{.Tag}} -X github.com/ory/keto/internal/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/internal/driver/config.Date={{.Date}} - "-extldflags '-static'" binary: keto env: @@ -79,7 +79,7 @@ builds: - id: keto ldflags: - - -s -w -X github.com/ory/keto/driver/config.Version={{.Tag}} -X github.com/ory/keto/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/driver/config.Date={{.Date}} + - -s -w -X github.com/ory/keto/internal/driver/config.Version={{.Tag}} -X github.com/ory/keto/internal/driver/config.Commit={{.FullCommit}} -X github.com/ory/keto/internal/driver/config.Date={{.Date}} binary: keto env: - CGO_ENABLED=0 diff --git a/internal/driver/registry_default.go b/internal/driver/registry_default.go index 7e2f7ed2b..9bcea2593 100644 --- a/internal/driver/registry_default.go +++ b/internal/driver/registry_default.go @@ -327,6 +327,7 @@ func (r *RegistryDefault) ReadRouter() http.Handler { br := &x.ReadRouter{Router: httprouter.New()} r.HealthHandler().SetHealthRoutes(br.Router, false) + r.HealthHandler().SetVersionRoutes(br.Router) for _, h := range r.allHandlers() { h.RegisterReadRoutes(br) @@ -351,6 +352,7 @@ func (r *RegistryDefault) WriteRouter() http.Handler { pr := &x.WriteRouter{Router: httprouter.New()} r.HealthHandler().SetHealthRoutes(pr.Router, false) + r.HealthHandler().SetVersionRoutes(pr.Router) for _, h := range r.allHandlers() { h.RegisterWriteRoutes(pr)