diff --git a/server/server.go b/server/server.go index c348c2e90a..da152a01bb 100644 --- a/server/server.go +++ b/server/server.go @@ -590,8 +590,10 @@ func (s *Server) Index(w http.ResponseWriter, _ *http.Request) { func (s *Server) Healthz(w http.ResponseWriter, _ *http.Request) { data, err := json.MarshalIndent(&struct { Status string `json:"status"` + AtlantisVersion string `json:"atlantis_version"` }{ Status: "ok", + AtlantisVersion: s.AtlantisVersion, }, "", " ") if err != nil { w.WriteHeader(http.StatusInternalServerError) diff --git a/server/server_test.go b/server/server_test.go index dfd2b870e3..9d680be813 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -157,7 +157,9 @@ func TestIndex_Success(t *testing.T) { } func TestHealthz(t *testing.T) { - s := server.Server{} + s := server.Server{ + AtlantisVersion: "0.14.0", + } req, _ := http.NewRequest("GET", "/healthz", bytes.NewBuffer(nil)) w := httptest.NewRecorder() s.Healthz(w, req) @@ -166,7 +168,8 @@ func TestHealthz(t *testing.T) { Equals(t, "application/json", w.Result().Header["Content-Type"][0]) Equals(t, `{ - "status": "ok" + "status": "ok", + "atlantis_version": "0.14.0", }`, string(body)) }