diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-23 20:52:44 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-23 20:52:44 +0000 |
commit | 63f39602dadd56da068a81684f73f5415e5ac926 (patch) | |
tree | 04cfdbf06ed1dfab364726101089fe335c44c638 | |
parent | 8d684d8f2efd4b277b5db7998d973ac87d6ba27d (diff) | |
parent | ab419b08ce7741f3471439a9b912fdb504130615 (diff) | |
download | gitlab-ce-63f39602dadd56da068a81684f73f5415e5ac926.tar.gz |
Merge branch 'add-gitlab-workhorse-version-to-admin-dashboard' into 'master'
Add gitlab-workhorse version to admin dashboard
## What does this MR do?
Add gitlab-workhorse version to admin dashboard.
## What are the relevant issue numbers?
Closes #15418
## Screenshot
![Zrzut_ekranu_2016-07-20_o_23.20.55](/uploads/ba6761e2145d903ac87bc7198bc8b182/Zrzut_ekranu_2016-07-20_o_23.20.55.png)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] Add test - show Gitlab Workhorse version on Admin Dashboard
- [x] All builds are passing
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
cc @ubudzisz @yorickpeterse @grzesiek [@chastell](https://github.com/chastell) [@tomash](https://github.com/tomash)
See merge request !5321
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/views/admin/dashboard/index.html.haml | 4 | ||||
-rw-r--r-- | lib/gitlab/workhorse.rb | 6 | ||||
-rw-r--r-- | spec/views/admin/dashboard/index.html.haml_spec.rb | 20 |
4 files changed, 31 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG index fa272755033..71ae0589948 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 a2ac407c159..452fc25ab07 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -80,6 +80,10 @@ %span.pull-right = Gitlab::Shell.new.version %p + GitLab Workhorse + %span.pull-right + = Gitlab::Workhorse.version + %p GitLab API %span.pull-right = API::API::version diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 6aeb49c0219..c6826a09bd2 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 00000000000..dae858a52f6 --- /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 |