summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-01-14 19:45:43 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-01-14 19:45:55 +0100
commitac652d82f17d378e485dcef15a8fabdcf9bad76b (patch)
tree722e6afd2ea63a43b15886b890138c3def3d5885 /app
parentba42b03348056e511df8484a8b342c7a2129c4f4 (diff)
downloadgitlab-ce-ac652d82f17d378e485dcef15a8fabdcf9bad76b.tar.gz
Let the CI runner know about builds that this build depends onci/build_dependencies
This allows us to implement artifacts passing: runner will download artifacts from all prior builds
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb8
-rw-r--r--app/uploaders/artifact_uploader.rb4
2 files changed, 12 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 6cc26abce66..16a5b03f591 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -128,6 +128,14 @@ module Ci
!self.commit.latest_builds_for_ref(self.ref).include?(self)
end
+ def depends_on_builds
+ # Get builds of the same type
+ latest_builds = self.commit.builds.similar(self).latest
+
+ # Return builds from previous stages
+ latest_builds.where('stage_idx < ?', stage_idx)
+ end
+
def trace_html
html = Ci::Ansi2html::convert(trace) if trace.present?
html || ''
diff --git a/app/uploaders/artifact_uploader.rb b/app/uploaders/artifact_uploader.rb
index 1b0ae6c0056..1cd93263c9f 100644
--- a/app/uploaders/artifact_uploader.rb
+++ b/app/uploaders/artifact_uploader.rb
@@ -32,6 +32,10 @@ class ArtifactUploader < CarrierWave::Uploader::Base
self.class.storage == CarrierWave::Storage::File
end
+ def filename
+ file.try(:filename)
+ end
+
def exists?
file.try(:exists?)
end