summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 20:54:30 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 20:54:30 +0200
commitdc975525a4116c5744d12115acc7f97328e43349 (patch)
tree23807e0c3d6674d3a9266022725e51e60e02650f
parent21136baa77369d5990ef5db4af26d688aedc8320 (diff)
parent5117412e33821f8eaf50befd2e00e431bfc74738 (diff)
downloadgitlab-ce-dc975525a4116c5744d12115acc7f97328e43349.tar.gz
Merge branch 'ci-commit-as-pipeline' into with-pipeline-view
-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 00a95dd05be..6abeddeeae6 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -138,24 +138,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?