Commit 2aa57071 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend runner config options for untagged jobs

parent a8a205cd
...@@ -4,7 +4,7 @@ module Ci ...@@ -4,7 +4,7 @@ module Ci
LAST_CONTACT_TIME = 5.minutes.ago LAST_CONTACT_TIME = 5.minutes.ago
AVAILABLE_SCOPES = %w[specific shared active paused online] AVAILABLE_SCOPES = %w[specific shared active paused online]
FORM_EDITABLE = %i[description tag_list active] FORM_EDITABLE = %i[description tag_list active run_untagged]
has_many :builds, class_name: 'Ci::Build' has_many :builds, class_name: 'Ci::Build'
has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject' has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject'
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
%span.runner-state.runner-state-specific %span.runner-state.runner-state-specific
Specific Specific
- if @runner.shared? - if @runner.shared?
%h4 This runner will process builds from ALL UNASSIGNED projects %h4 This runner will process builds from ALL UNASSIGNED projects
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- if @runners.include?(runner) - if @runners.include?(runner)
= link_to runner.short_sha, runner_path(runner) = link_to runner.short_sha, runner_path(runner)
%small %small
=link_to edit_namespace_project_runner_path(@project.namespace, @project, runner) do = link_to edit_namespace_project_runner_path(@project.namespace, @project, runner) do
%i.fa.fa-edit.btn %i.fa.fa-edit.btn
- else - else
= runner.short_sha = runner.short_sha
...@@ -17,50 +17,39 @@ ...@@ -17,50 +17,39 @@
%th Property Name %th Property Name
%th Value %th Value
%tr %tr
%td %td Active
Tags %td= ? 'Yes' : 'No'
%td Can run untagged jobs
%td= @runner.run_untagged? ? 'Yes' : 'No'
%td Tags
%td %td
- @runner.tag_list.each do |tag| - @runner.tag_list.each do |tag|
%span.label.label-primary %span.label.label-primary
= tag = tag
%tr %tr
%td %td Name
Name %td=
%tr %tr
%td %td Version
Version %td= @runner.version
= @runner.version
%tr %tr
%td %td Revision
Revision %td= @runner.revision
= @runner.revision
%tr %tr
%td %td Platform
Platform %td= @runner.platform
= @runner.platform
%tr %tr
%td %td Architecture
Architecture %td= @runner.architecture
= @runner.architecture
%tr %tr
%td %td Description
Description %td= @runner.description
= @runner.description
%tr %tr
%td %td Last contact
Last contact
%td %td
- if @runner.contacted_at - if @runner.contacted_at
#{time_ago_in_words(@runner.contacted_at)} ago #{time_ago_in_words(@runner.contacted_at)} ago
- else - else
Never Never
...@@ -110,4 +110,33 @@ describe "Runners" do ...@@ -110,4 +110,33 @@ describe "Runners" do
expect(page).to have_content(@specific_runner.platform) expect(page).to have_content(@specific_runner.platform)
end end
end end
feature 'configuring runners ability to picking untagged jobs' do
given(:project) { create(:empty_project) }
given(:runner) { create(:ci_runner) }
background do << [user, :master]
project.runners << runner
scenario 'user checks default configuration' do
visit namespace_project_runner_path(project.namespace, project, runner)
expect(page).to have_content 'Can run untagged jobs Yes'
scenario 'user want to prevent runner from running untagged job' do
visit runners_path(project)
page.within('.activated-specific-runners') do
first('small > a').click
uncheck 'runner_run_untagged'
click_button 'Save changes'
expect(page).to have_content 'Can run untagged jobs No'
expect(runner.reload.run_untagged?).to eq false
end end
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment