server: add git revision to serf tags (#9159)

This commit is contained in:
Drew Gonzales 2022-11-07 07:34:33 -08:00 committed by GitHub
parent 85521c49c4
commit aac9404ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

3
.changelog/9159.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
server: Add a git `revision` tag to the serf tags gossiped between servers.
```

View File

@ -171,6 +171,7 @@ func convertServerConfig(agentConfig *Config) (*nomad.Config, error) {
conf.EnableDebug = agentConfig.EnableDebug
conf.Build = agentConfig.Version.VersionNumber()
conf.Revision = agentConfig.Version.Revision
if agentConfig.Region != "" {
conf.Region = agentConfig.Region
}

View File

@ -128,6 +128,10 @@ type Config struct {
// operators track which versions are actively deployed
Build string
// Revision is a string that carries the version.GitCommit of Nomad that
// was compiled.
Revision string
// NumSchedulers is the number of scheduler thread that are run.
// This can be as many as one per core, or zero to disable this server
// from doing any scheduling work.

View File

@ -1517,6 +1517,7 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string) (
conf.Tags["region"] = s.config.Region
conf.Tags["dc"] = s.config.Datacenter
conf.Tags["build"] = s.config.Build
conf.Tags["revision"] = s.config.Revision
conf.Tags["vsn"] = deprecatedAPIMajorVersionStr // for Nomad <= v1.2 compat
conf.Tags["raft_vsn"] = fmt.Sprintf("%d", s.config.RaftConfig.ProtocolVersion)
conf.Tags["id"] = s.config.NodeID