diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-03-16 14:45:05 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-20 09:40:36 +0100 |
commit | c191c1103b37903f2293c2a662cdc616228b9eb7 (patch) | |
tree | db984310faca38cef2d283d0a9746f229a6dc6c1 /app | |
parent | 9267a9b19d6c7e090c286e9d922c71fe64190a47 (diff) | |
download | gitlab-ce-c191c1103b37903f2293c2a662cdc616228b9eb7.tar.gz |
Send only defined dependencies
In APIv1 we've been sending all jobs from previous stages and
a `dependencies` list with names of jobs that user want to download
artifacts from. This was selected on Runners side.
In APIv1 we've planned to send only jobs that were defined (if any; and
all previous jobs by default). However I've missed the fact that
it was Runner who selected jobs, not GitLab. And now current version
of APIV4 sends all jobs everytime.
This commit fixes this. If user will define `dependencies` in his job,
then GitLab will send only selected jobs.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 53fc0d87823..90a195dc048 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -539,6 +539,21 @@ module Ci Gitlab::Ci::Build::Credentials::Factory.new(self).create! end + def dependencies + depended_jobs = depends_on_builds + + return depended_jobs unless options[:dependencies] && !options[:dependencies].empty? + + selected = [] + depended_jobs.each do |job| + options[:dependencies].each do |job_name| + selected << job if job.name == job_name + end + end + + selected + end + private def update_artifacts_size |