summaryrefslogtreecommitdiff
path: root/app/models/ci/commit.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 20:54:21 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 20:54:21 +0200
commit5117412e33821f8eaf50befd2e00e431bfc74738 (patch)
tree61e69fa05b815b13fe52ec60761dc73ee64f29af /app/models/ci/commit.rb
parent2a7f7f75285e3818ac9c90b3e6c7893f4999e33e (diff)
downloadgitlab-ce-5117412e33821f8eaf50befd2e00e431bfc74738.tar.gz
Fix implementation of config_processor and ci_yaml_file
Diffstat (limited to 'app/models/ci/commit.rb')
-rw-r--r--app/models/ci/commit.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 334d3c7bc45..ae30407bcae 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -127,24 +127,29 @@ module Ci
def config_processor
return nil unless ci_yaml_file
- @config_processor ||= Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.path_with_namespace)
- rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
- save_yaml_error(e.message)
- nil
- rescue
- save_yaml_error("Undefined error")
- nil
+ return @config_processor if defined?(@config_processor)
+
+ @config_processor ||= begin
+ Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.path_with_namespace)
+ rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
+ save_yaml_error(e.message)
+ nil
+ rescue
+ save_yaml_error("Undefined error")
+ nil
+ end
end
def ci_yaml_file
- return nil if defined?(@ci_yaml_file)
+ return @ci_yaml_file if defined?(@ci_yaml_file)
+
@ci_yaml_file ||= begin
blob = project.repository.blob_at(sha, '.gitlab-ci.yml')
blob.load_all_data!(project.repository)
blob.data
+ rescue
+ nil
end
- rescue
- nil
end
def skip_ci?