Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-18 15:50:25 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-18 15:50:25 +0300
commit8b05abe816b0c681ac218096b294311dd04fde8b (patch)
tree58570725e5d3d3a2c7dc38e184c97d8362d485f9 /lib
parent1eb3dde45b55afb723954e577b7bd12946aeb3ca (diff)
parent97fa9904064b6799be7f329651387c5df2fd0387 (diff)
Merge branch 'allow-to-disable-ci' into 'master'
Allow to disable GitLab CI Added simple config option to disable GitLab CI It makes all CI related requests to return 404 /cc @dzaporozhets @jacobvosmaer @vsizov See merge request !1340
Diffstat (limited to 'lib')
-rw-r--r--lib/ci/api/api.rb4
-rw-r--r--lib/ci/api/helpers.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/ci/api/api.rb b/lib/ci/api/api.rb
index 172c6f22164..7bb8869d61a 100644
--- a/lib/ci/api/api.rb
+++ b/lib/ci/api/api.rb
@@ -23,6 +23,10 @@ module Ci
rack_response({ 'message' => '500 Internal Server Error' }, 500)
end
+ before do
+ check_enable_flag!
+ end
+
format :json
helpers Helpers
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb
index e602cda81d6..8e893aa5cc6 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -3,6 +3,12 @@ module Ci
module Helpers
UPDATE_RUNNER_EVERY = 60
+ def check_enable_flag!
+ unless current_application_settings.ci_enabled
+ render_api_error!('400 (Bad request) CI is disabled', 400)
+ end
+ end
+
def authenticate_runners!
forbidden! unless params[:token] == GitlabCi::REGISTRATION_TOKEN
end