diff --git a/CHANGELOG b/CHANGELOG index fa2727550338dc404178575f5e0044b45168b6df..71ae0589948d06b93fd4d664db51822d2f8ecaef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ v 8.11.0 (unreleased) - Limit git rev-list output count to one in forced push check - Retrieve rendered HTML from cache in one request - Load project invited groups and members eagerly in ProjectTeam#fetch_members + - Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska) v 8.10.0 - Fix profile activity heatmap to show correct day name (eanplatter) diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index a2ac407c159b79d2d6e765538486b454bee659d3..452fc25ab07552fddce682739c1fb20fbb001d76 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -79,6 +79,10 @@ GitLab Shell %span.pull-right = Gitlab::Shell.new.version + %p + GitLab Workhorse + %span.pull-right + = Gitlab::Workhorse.version %p GitLab API %span.pull-right diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 6aeb49c02196e5534f6159da131d56ea3431cab3..c6826a09bd285cf5e9b543f425460a22ebf84c18 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -4,6 +4,7 @@ require 'json' module Gitlab class Workhorse SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data' + VERSION_FILE = 'GITLAB_WORKHORSE_VERSION' class << self def git_http_ok(repository, user) @@ -75,6 +76,11 @@ module Gitlab ] end + def version + path = Rails.root.join(VERSION_FILE) + path.readable? ? path.read.chomp : 'unknown' + end + protected def encode(hash) diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..dae858a52f6b3bf1f3bb7016698137360117b6b0 --- /dev/null +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe 'admin/dashboard/index.html.haml' do + include Devise::TestHelpers + + before do + assign(:projects, create_list(:empty_project, 1)) + assign(:users, create_list(:user, 1)) + assign(:groups, create_list(:group, 1)) + + allow(view).to receive(:admin?).and_return(true) + end + + it "shows version of GitLab Workhorse" do + render + + expect(rendered).to have_content 'GitLab Workhorse' + expect(rendered).to have_content Gitlab::Workhorse.version + end +end