summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-15 15:51:41 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-18 09:54:52 -0400
commit6b124d42d9861a5f8c3dd5add7cabc864fa3673c (patch)
tree12361ba8b27fc9e0ed2a9a9862980fdc05bd9e8d
parent5ae4fd2181e81f6e75a9d4021fc7d0c4749139ef (diff)
downloadgitlab-ce-6b124d42d9861a5f8c3dd5add7cabc864fa3673c.tar.gz
Add configurable shared runners text
-rw-r--r--CHANGELOG2
-rw-r--r--app/controllers/admin/application_settings_controller.rb1
-rw-r--r--app/helpers/application_settings_helper.rb4
-rw-r--r--app/views/admin/application_settings/_form.html.haml6
-rw-r--r--app/views/projects/runners/_shared_runners.html.haml7
-rw-r--r--db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--spec/features/runners_spec.rb16
8 files changed, 40 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 571c31e63a2..d1b20a34b17 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,8 @@ v 8.7.0 (unreleased)
- Allow projects to be transfered to a lower visibility level group
- Fix `signed_in_ip` being set to 127.0.0.1 when using a reverse proxy !3524
- Improved Markdown rendering performance !3389
+ - Improved Markdown rendering performance !3389 (Yorick Peterse)
+ - Make shared runners text in box configurable (Kamil TrzciƄski)
- Don't attempt to look up an avatar in repo if repo directory does not exist (Stan Hu)
- API: Ability to subscribe and unsubscribe from issues and merge requests (Robert Schilling)
- Expose project badges in project settings
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index b4a28b8dd3f..2520d4452a2 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -75,6 +75,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:admin_notification_email,
:user_oauth_applications,
:shared_runners_enabled,
+ :shared_runners_text,
:max_artifacts_size,
:metrics_enabled,
:metrics_host,
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 60a0ff32c9c..914b0ef6042 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -15,6 +15,10 @@ module ApplicationSettingsHelper
current_application_settings.sign_in_text
end
+ def shared_runners_text
+ current_application_settings.shared_runners_text
+ end
+
def user_oauth_applications?
current_application_settings.user_oauth_applications
end
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index 555aea554f0..e5bc7d4fdbe 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -153,7 +153,11 @@
= f.label :shared_runners_enabled do
= f.check_box :shared_runners_enabled
Enable shared runners for new projects
-
+ .form-group
+ = f.label :shared_runners_text, class: 'control-label col-sm-2'
+ .col-sm-10
+ = f.text_area :shared_runners_text, class: 'form-control', rows: 4
+ .help-block Markdown enabled
.form-group
= f.label :max_artifacts_size, 'Maximum artifacts size (MB)', class: 'control-label col-sm-2'
.col-sm-10
diff --git a/app/views/projects/runners/_shared_runners.html.haml b/app/views/projects/runners/_shared_runners.html.haml
index 6a37f444bb7..ec47ed79e55 100644
--- a/app/views/projects/runners/_shared_runners.html.haml
+++ b/app/views/projects/runners/_shared_runners.html.haml
@@ -1,7 +1,10 @@
%h3 Shared runners
-.bs-callout.bs-callout-warning
- GitLab Runners do not offer secure isolation between projects that they do builds for. You are TRUSTING all GitLab users who can push code to project A, B or C to run shell scripts on the machine hosting runner X.
+.bs-callout.bs-callout-warning.shared-runners-description
+ - if shared_runners_text.present?
+ = markdown(shared_runners_text)
+ - else
+ GitLab Runners do not offer secure isolation between projects that they do builds for. You are TRUSTING all GitLab users who can push code to project A, B or C to run shell scripts on the machine hosting runner X.
%hr
- if @project.shared_runners_enabled?
= link_to toggle_shared_runners_namespace_project_runners_path(@project.namespace, @project), class: 'btn btn-warning', method: :post do
diff --git a/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb
new file mode 100644
index 00000000000..d493044c67b
--- /dev/null
+++ b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb
@@ -0,0 +1,5 @@
+class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration
+ def change
+ add_column :application_settings, :shared_runners_text, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 42c261003bb..0ab32cab8b4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160412140240) do
+ActiveRecord::Schema.define(version: 20160415133440) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -78,6 +78,7 @@ ActiveRecord::Schema.define(version: 20160412140240) do
t.boolean "email_author_in_body", default: false
t.integer "default_group_visibility"
t.boolean "repository_checks_enabled", default: true
+ t.text "shared_runners_text"
end
create_table "audit_events", force: :cascade do |t|
diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb
index e8886e7edf9..1fe7645250c 100644
--- a/spec/features/runners_spec.rb
+++ b/spec/features/runners_spec.rb
@@ -80,6 +80,22 @@ describe "Runners" do
end
end
+ describe "shared runners description" do
+ let(:shared_runners_text) { 'custom shared runners description' }
+
+ before { stub_application_setting(shared_runners_text: shared_runners_text) }
+
+ before do
+ @project = FactoryGirl.create :empty_project, shared_runners_enabled: false
+ @project.team << [user, :master]
+ visit runners_path(@project)
+ end
+
+ it "sees shared runners description" do
+ expect(page.find(".shared-runners-description")).to have_content(shared_runners_text)
+ end
+ end
+
describe "show page" do
before do
@project = FactoryGirl.create :empty_project