Skip to content

Commit

Permalink
server: add git revision to serf tags (#9159)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewgonzales360 authored Nov 7, 2022
1 parent 6a75882 commit 1a1ce36
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/9159.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
server: Add a git `revision` tag to the serf tags gossiped between servers.
```
1 change: 1 addition & 0 deletions command/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions nomad/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions nomad/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a1ce36

Please sign in to comment.