diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-08-29 09:56:03 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-03 17:49:10 +0300 |
commit | 1024718e9fddbb0d61d3f64f44303964641fcdd8 (patch) | |
tree | 3eef4777a58c9d3e798827ca39e3a5fa0602088c /app | |
parent | 3875983205fd3cdbdc93f18b118deaf098d75af1 (diff) |
Refactor access_level to not_protected and ref_protected
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/ci/runner.rb | 6 | ||||
-rw-r--r-- | app/services/ci/register_job_service.rb | 2 | ||||
-rw-r--r-- | app/views/projects/runners/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/runners/show.html.haml | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 04d5b85ab01..e58484878ba 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -34,7 +34,7 @@ module Ci scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) } - scope :protected_, -> { where(protected: true) } + scope :ref_protected, -> { where(protected: true) } mount_uploader :artifacts_file, ArtifactUploader mount_uploader :artifacts_metadata, ArtifactUploader diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index a3b4a1fccf3..f202f08b151 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -41,8 +41,8 @@ module Ci after_destroy :cleanup_runner_queue enum access_level: { - unprotected: 0, - protected_: 1 + not_protected: 0, + ref_protected: 1 } # Searches for runners matching the given query. @@ -111,7 +111,7 @@ module Ci end def can_pick?(build) - return false if self.protected_? && !build.protected? + return false if self.ref_protected? && !build.protected? assignable_for?(build.project) && accepting_tags?(build) end diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 1f243de5761..b8db709211a 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -78,7 +78,7 @@ module Ci def new_builds builds = Ci::Build.pending.unstarted - builds = builds.protected_ if runner.protected_? + builds = builds.ref_protected if runner.ref_protected? builds end diff --git a/app/views/projects/runners/_form.html.haml b/app/views/projects/runners/_form.html.haml index 8c98075eeb5..ac8e15a48b2 100644 --- a/app/views/projects/runners/_form.html.haml +++ b/app/views/projects/runners/_form.html.haml @@ -10,7 +10,7 @@ = label :protected, "Protected", class: 'control-label' .col-sm-10 .checkbox - = f.check_box :access_level, {}, 'protected_', 'unprotected' + = f.check_box :access_level, {}, 'ref_protected', 'not_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' diff --git a/app/views/projects/runners/show.html.haml b/app/views/projects/runners/show.html.haml index 9d427d18272..dfab04aa1fb 100644 --- a/app/views/projects/runners/show.html.haml +++ b/app/views/projects/runners/show.html.haml @@ -21,7 +21,7 @@ %td= @runner.active? ? 'Yes' : 'No' %tr %td Protected - %td= @runner.protected_? ? 'Yes' : 'No' + %td= @runner.ref_protected? ? 'Yes' : 'No' %tr %td Can run untagged jobs %td= @runner.run_untagged? ? 'Yes' : 'No' |