summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 06:07:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 06:07:58 +0000
commit9c83aadd2604e7e6cb1f84683f951e6b12872618 (patch)
treec0a14c87378e832e87580be382e1c8ccea188b71 /app/models/ci/build.rb
parent23bc19cb73aad969c9636b8b935111645e809e54 (diff)
downloadgitlab-ce-9c83aadd2604e7e6cb1f84683f951e6b12872618.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb54
1 files changed, 11 insertions, 43 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index d0ea7439556..f9d17bfc8b7 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -513,14 +513,6 @@ module Ci
success? && !deployment.try(:last?)
end
- def depends_on_builds
- # Get builds of the same type
- latest_builds = self.pipeline.builds.latest
-
- # Return builds from previous stages
- latest_builds.where('stage_idx < ?', stage_idx)
- end
-
def triggered_by?(current_user)
user == current_user
end
@@ -825,41 +817,15 @@ module Ci
end
def all_dependencies
- (dependencies + cross_dependencies).uniq
- end
-
- def dependencies
- return [] if empty_dependencies?
-
- depended_jobs = depends_on_builds
-
- # find all jobs that are needed
- if Feature.enabled?(:ci_dag_support, project, default_enabled: true) && scheduling_type_dag?
- depended_jobs = depended_jobs.where(name: needs.artifacts.select(:name))
- end
-
- # find all jobs that are dependent on
- if options[:dependencies].present?
- depended_jobs = depended_jobs.where(name: options[:dependencies])
- end
-
- # if both needs and dependencies are used,
- # the end result will be an intersection between them
- depended_jobs
- end
-
- def cross_dependencies
- []
- end
-
- def empty_dependencies?
- options[:dependencies]&.empty?
+ dependencies.all
end
def has_valid_build_dependencies?
- return true if Feature.enabled?('ci_disable_validates_dependencies')
+ dependencies.valid?
+ end
- dependencies.all?(&:valid_dependency?)
+ def invalid_dependencies
+ dependencies.invalid_local
end
def valid_dependency?
@@ -869,10 +835,6 @@ module Ci
true
end
- def invalid_dependencies
- dependencies.reject(&:valid_dependency?)
- end
-
def runner_required_feature_names
strong_memoize(:runner_required_feature_names) do
RUNNER_FEATURES.select do |feature, method|
@@ -950,6 +912,12 @@ module Ci
private
+ def dependencies
+ strong_memoize(:dependencies) do
+ Ci::Processable::Dependencies.new(self)
+ end
+ end
+
def build_data
@build_data ||= Gitlab::DataBuilder::Build.build(self)
end