diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-31 21:59:04 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-03 23:49:10 +0900 |
commit | e9924687147b1222fa2df3765a1e3c37662028a2 (patch) | |
tree | aee3d554f695a51f669dd845c93ae0c7d9b39ccd | |
parent | 81002745184df28fc9d969afc524986279c653bb (diff) | |
download | gitlab-ce-e9924687147b1222fa2df3765a1e3c37662028a2.tar.gz |
ini
-rw-r--r-- | app/models/ci/runner.rb | 2 | ||||
-rw-r--r-- | app/views/projects/runners/_form.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/runners/show.html.haml | 3 | ||||
-rw-r--r-- | db/migrate/20170731123938_add_protected_to_ci_runners.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 1 |
5 files changed, 26 insertions, 1 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 906a76ec560..05b45be5e91 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -5,7 +5,7 @@ module Ci RUNNER_QUEUE_EXPIRY_TIME = 60.minutes ONLINE_CONTACT_TIMEOUT = 1.hour AVAILABLE_SCOPES = %w[specific shared active paused online].freeze - FORM_EDITABLE = %i[description tag_list active run_untagged locked].freeze + FORM_EDITABLE = %i[description tag_list active run_untagged locked protected].freeze has_many :builds has_many :runner_projects, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent diff --git a/app/views/projects/runners/_form.html.haml b/app/views/projects/runners/_form.html.haml index 2ef1f98ba48..7dae8ecbb94 100644 --- a/app/views/projects/runners/_form.html.haml +++ b/app/views/projects/runners/_form.html.haml @@ -7,6 +7,12 @@ = f.check_box :active %span.light Paused Runners don't accept new jobs .form-group + = label :protected, "Protected", class: 'control-label' + .col-sm-10 + .checkbox + = f.check_box :protected + %span.light This runner will only run on pipelines trigged on protected branches + .form-group = label :run_untagged, 'Run untagged jobs', class: 'control-label' .col-sm-10 .checkbox diff --git a/app/views/projects/runners/show.html.haml b/app/views/projects/runners/show.html.haml index 49415ba557b..e51bb299938 100644 --- a/app/views/projects/runners/show.html.haml +++ b/app/views/projects/runners/show.html.haml @@ -20,6 +20,9 @@ %td Active %td= @runner.active? ? 'Yes' : 'No' %tr + %td Protected + %td= @runner.protected? ? 'Yes' : 'No' + %tr %td Can run untagged jobs %td= @runner.run_untagged? ? 'Yes' : 'No' %tr diff --git a/db/migrate/20170731123938_add_protected_to_ci_runners.rb b/db/migrate/20170731123938_add_protected_to_ci_runners.rb new file mode 100644 index 00000000000..3782e047eee --- /dev/null +++ b/db/migrate/20170731123938_add_protected_to_ci_runners.rb @@ -0,0 +1,15 @@ +class AddProtectedToCiRunners < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:ci_runners, :protected, :boolean, default: false) + end + + def down + remove_column(:ci_runners, :protected) + end +end diff --git a/db/schema.rb b/db/schema.rb index 434d1326419..be12fc07e81 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -371,6 +371,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.string "architecture" t.boolean "run_untagged", default: true, null: false t.boolean "locked", default: false, null: false + t.boolean "protected", default: false, null: false end add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree |