summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 13154eb4205..908d765fb47 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -467,6 +467,18 @@ class Repository
end
end
+ def gitlab_ci_yml
+ return nil if !exists? || empty?
+
+ @gitlab_ci_yml ||= tree(:head).blobs.find do |file|
+ file.name == '.gitlab-ci.yml'
+ end
+ rescue Rugged::ReferenceError
+ # For unknow reason spinach scenario "Scenario: I change project path"
+ # lead to "Reference 'HEAD' not found" exception from Repository#empty?
+ nil
+ end
+
def head_commit
@head_commit ||= commit(self.root_ref)
end