summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-12-07 10:06:07 +0100
committerZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-12-07 10:06:07 +0100
commit0e96d6eb10f92f14d9c06e1728b1a3597a856d2a (patch)
treee003ee5ba773743fb856f9899b2a2c311139f048 /app/models/ci
parent46278ec7ba7c618acaf7381ad466742ce84e33db (diff)
parent234f4bf20fb338f2164976fd39203fbc671afd29 (diff)
downloadgitlab-ce-0e96d6eb10f92f14d9c06e1728b1a3597a856d2a.tar.gz
Merge branch 'master' into merge-if-green
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/application_setting.rb9
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/ci/commit.rb8
3 files changed, 13 insertions, 6 deletions
diff --git a/app/models/ci/application_setting.rb b/app/models/ci/application_setting.rb
index 1307fa0b472..7f5df8ce6c4 100644
--- a/app/models/ci/application_setting.rb
+++ b/app/models/ci/application_setting.rb
@@ -12,13 +12,18 @@
module Ci
class ApplicationSetting < ActiveRecord::Base
extend Ci::Model
+ CACHE_KEY = 'ci_application_setting.last'
after_commit do
- Rails.cache.write('ci_application_setting.last', self)
+ Rails.cache.write(CACHE_KEY, self)
+ end
+
+ def self.expire
+ Rails.cache.delete(CACHE_KEY)
end
def self.current
- Rails.cache.fetch('ci_application_setting.last') do
+ Rails.cache.fetch(CACHE_KEY) do
Ci::ApplicationSetting.last
end
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index e78b154084b..52ce1b920fa 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -97,6 +97,8 @@ module Ci
state_machine :status, initial: :pending do
after_transition any => [:success, :failed, :canceled] do |build, transition|
+ return unless build.gl_project
+
project = build.project
if project.web_hooks?
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index f96b479feac..0f74a7f0688 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -196,13 +196,13 @@ module Ci
end
def config_processor
+ return nil unless ci_yaml_file
@config_processor ||= Ci::GitlabCiYamlProcessor.new(ci_yaml_file, gl_project.path_with_namespace)
- rescue Ci::GitlabCiYamlProcessor::ValidationError => e
+ rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
save_yaml_error(e.message)
nil
- rescue Exception => e
- logger.error e.message + "\n" + e.backtrace.join("\n")
- save_yaml_error("Undefined yaml error")
+ rescue
+ save_yaml_error("Undefined error")
nil
end