Move to setting version info explicitly in linker flags
Some checks failed
/ golint (push) Failing after 12s
Some checks failed
/ golint (push) Failing after 12s
We don't have go built-in VCS information in a nix build because the git repository isn't present. After struggling to build an overlay that would provide it, I decided this path is easier of just injecting in the data that we need. Issue: #5
This commit is contained in:
parent
81826f853e
commit
d4cbfb960e
8 changed files with 119 additions and 79 deletions
|
|
@ -322,7 +322,7 @@ type tegolaURLs struct {
|
|||
}
|
||||
|
||||
func getRoot(ctx context.Context, r *http.Request, q resource.QueryParams) (*about, *nhttp.ErrorWithStatus) {
|
||||
v := version.Get()
|
||||
v := GetVersionInfo()
|
||||
return &about{
|
||||
Environment: config.Environment,
|
||||
SentryDSN: config.SentryDSNFrontend,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
"source.gleipnir.technology/Gleipnir/nidus-sync/lint"
|
||||
"source.gleipnir.technology/Gleipnir/nidus-sync/platform"
|
||||
"source.gleipnir.technology/Gleipnir/nidus-sync/platform/event"
|
||||
"source.gleipnir.technology/Gleipnir/nidus-sync/version"
|
||||
)
|
||||
|
||||
var connectionsSSE map[*ConnectionSSE]bool = make(map[*ConnectionSSE]bool, 0)
|
||||
|
|
@ -41,7 +40,7 @@ type Status struct {
|
|||
|
||||
func (c *ConnectionSSE) SendEvent(w http.ResponseWriter, m platform.Event) error {
|
||||
if m.Type == event.EventTypeShutdown {
|
||||
v := version.Get()
|
||||
v := GetVersionInfo()
|
||||
return send(w, Status{
|
||||
BuildTime: v.BuildTime,
|
||||
IsModified: v.IsModified,
|
||||
|
|
@ -121,7 +120,7 @@ func streamEvents(w http.ResponseWriter, r *http.Request, u platform.User) {
|
|||
log.Debug().Int32("org", u.Organization.ID).Int("user", u.ID).Str("id", uid.String()).Msg("connected SSE client")
|
||||
|
||||
// Send an initial connected event
|
||||
v := version.Get()
|
||||
v := GetVersionInfo()
|
||||
status := Status{
|
||||
BuildTime: v.BuildTime,
|
||||
IsModified: v.IsModified,
|
||||
|
|
|
|||
16
api/version.go
Normal file
16
api/version.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"source.gleipnir.technology/Gleipnir/nidus-sync/version"
|
||||
)
|
||||
|
||||
var (
|
||||
versionInfo version.VersionInfo
|
||||
)
|
||||
|
||||
func GetVersionInfo() version.VersionInfo {
|
||||
return versionInfo
|
||||
}
|
||||
func SetVersionInfo(v version.VersionInfo) {
|
||||
versionInfo = v
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue