diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-31 21:59:04 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-08-01 16:50:40 +0900 |
commit | 3fcbfabb091619b2199c7391efa202f418294efc (patch) | |
tree | 792c78c69c21a5e36fac37b4a70a5d3219fa3ea1 | |
parent | faa2a123911eaf84bb57163ea7af759d4632601b (diff) | |
download | gitlab-ce-3fcbfabb091619b2199c7391efa202f418294efc.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 | 3 |
5 files changed, 27 insertions, 2 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index c6d23898560..765a1763b52 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 5fbbdea6eaa..65697d1fbd8 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: 20170725145659) do +ActiveRecord::Schema.define(version: 20170731123938) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -363,6 +363,7 @@ ActiveRecord::Schema.define(version: 20170725145659) 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 |