diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-19 21:54:33 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-19 21:54:33 +0000 |
commit | f26389a02a48a53cccb3bb7dd1d7bcd4858c118d (patch) | |
tree | e075ed3e3a0446cc5e0a323ba50f895c0778c49b /app/controllers | |
parent | f73def90a83e7cddda0960b2c780c59835c228fb (diff) | |
parent | 52c8b9da37451943fe97f3a687d43ae39105aaa0 (diff) | |
download | gitlab-ce-f26389a02a48a53cccb3bb7dd1d7bcd4858c118d.tar.gz |
Merge branch 'feature/runner-config-untagged-jobs' into 'master'
Add config for CI Runner that prevents it from picking untagged jobs
Closes #3456
See merge request !4039
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 35 | ||||
-rw-r--r-- | app/controllers/projects/runners_controller.rb | 2 |
2 files changed, 22 insertions, 15 deletions
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 8b8a7320072..7345c91f67d 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -9,23 +9,18 @@ class Admin::RunnersController < Admin::ApplicationController end def show - @builds = @runner.builds.order('id DESC').first(30) - @projects = - if params[:search].present? - ::Project.search(params[:search]) - else - Project.all - end - @projects = @projects.where.not(id: @runner.projects.select(:id)) if @runner.projects.any? - @projects = @projects.page(params[:page]).per(30) + assign_builds_and_projects end def update - @runner.update_attributes(runner_params) - - respond_to do |format| - format.js - format.html { redirect_to admin_runner_path(@runner) } + if @runner.update_attributes(runner_params) + respond_to do |format| + format.js + format.html { redirect_to admin_runner_path(@runner) } + end + else + assign_builds_and_projects + render 'show' end end @@ -60,4 +55,16 @@ class Admin::RunnersController < Admin::ApplicationController def runner_params params.require(:runner).permit(Ci::Runner::FORM_EDITABLE) end + + def assign_builds_and_projects + @builds = runner.builds.order('id DESC').first(30) + @projects = + if params[:search].present? + ::Project.search(params[:search]) + else + Project.all + end + @projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any? + @projects = @projects.page(params[:page]).per(30) + end end diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb index 3a9d67aff64..0b4fa572501 100644 --- a/app/controllers/projects/runners_controller.rb +++ b/app/controllers/projects/runners_controller.rb @@ -20,7 +20,7 @@ class Projects::RunnersController < Projects::ApplicationController if @runner.update_attributes(runner_params) redirect_to runner_path(@runner), notice: 'Runner was successfully updated.' else - redirect_to runner_path(@runner), alert: 'Runner was not updated.' + render 'edit' end end |