diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-04-14 17:05:54 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-04-21 19:28:17 +0300 |
commit | e771203ccf27462fe4918b26ef042561187bfe68 (patch) | |
tree | 7d22474616f0918a6f778c42a272a0d93cbb9830 /app | |
parent | 26ea08c2b05b2050f16224f6dd729b195c9e5d5e (diff) | |
download | gitlab-ci-e771203ccf27462fe4918b26ef042561187bfe68.tar.gz |
toggle shared runners
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 9 | ||||
-rw-r--r-- | app/helpers/runners_helper.rb | 2 | ||||
-rw-r--r-- | app/views/projects/_form.html.haml | 7 | ||||
-rw-r--r-- | app/views/runners/_shared_runners.html.haml | 6 |
4 files changed, 11 insertions, 13 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4171983..654820e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,8 +1,8 @@ class ProjectsController < ApplicationController before_filter :authenticate_user!, except: [:build, :badge, :index, :show] - before_filter :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy] + before_filter :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners] before_filter :authorize_access_project!, except: [:build, :gitlab, :badge, :index, :show, :new, :create] - before_filter :authorize_manage_project!, only: [:edit, :integration, :update, :destroy] + before_filter :authorize_manage_project!, only: [:edit, :integration, :update, :destroy, :toggle_shared_runners] before_filter :authenticate_token!, only: [:build] before_filter :no_cache, only: [:badge] protect_from_forgery except: :build @@ -98,6 +98,11 @@ class ProjectsController < ApplicationController send_file image.path, filename: image.name, disposition: 'inline' end + def toggle_shared_runners + project.toggle!(:shared_runners_enabled) + redirect_to :back + end + protected def project diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb index 487fba0..290255f 100644 --- a/app/helpers/runners_helper.rb +++ b/app/helpers/runners_helper.rb @@ -8,7 +8,7 @@ module RunnersHelper status = if runner.active? - if runner.contacted_at > 1.hour.ago + if runner.contacted_at > 3.hour.ago :online else :offline diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index f04ca33..3702f7e 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -61,13 +61,6 @@ = f.check_box :public %span.light Anyone can see project and builds .form-group - = f.label :shared_runners_enabled, 'Allow shared runners', class: 'control-label' - .col-sm-10 - .checkbox - = f.label :shared_runners_enabled do - = f.check_box :shared_runners_enabled - %span.light Allow run builds on shared runners - .form-group = f.label :coverage_regex, "Test coverage parsing", class: 'control-label' .col-sm-10 .input-group diff --git a/app/views/runners/_shared_runners.html.haml b/app/views/runners/_shared_runners.html.haml index 45d967f..642e3f6 100644 --- a/app/views/runners/_shared_runners.html.haml +++ b/app/views/runners/_shared_runners.html.haml @@ -1,13 +1,13 @@ %h3 Shared runners .bs-callout.bs-callout-warning - Put text about secutiry impact of using shared runner + 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 '#', class: 'btn btn-warning' do + = link_to toggle_shared_runners_project_path(@project), class: 'btn btn-warning', method: :post do Disable shared runners - else - = link_to '#', class: 'btn btn-warning' do + = link_to toggle_shared_runners_project_path(@project), class: 'btn btn-success', method: :post do Enable shared runners for this project |