diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-09-04 17:56:49 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-12-06 15:53:59 +0900 |
commit | 6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3 (patch) | |
tree | c44165535bd71c1017f610186105293fba413022 /app | |
parent | 8917726bb5e6746750129c0d9322c2daa7f88172 (diff) | |
download | gitlab-ce-6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3.tar.gz |
Use Class.new(StandardError) instead of custom extended error class. Bring back specified_dependencies?.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 10 | ||||
-rw-r--r-- | app/services/ci/register_job_service.rb | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 119c6fd7b45..965ba35c8b0 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -6,6 +6,8 @@ module Ci include Presentable include Importable + MissingDependenciesError = Class.new(StandardError) + belongs_to :runner belongs_to :trigger_request belongs_to :erased_by, class_name: 'User' @@ -141,8 +143,8 @@ module Ci end before_transition any => [:running] do |build| - if !build.empty_dependencies? && build.dependencies.empty? - raise Gitlab::Ci::Error::MissingDependencies + if build.specified_dependencies? && build.dependencies.empty? + raise MissingDependenciesError end end end @@ -484,6 +486,10 @@ module Ci options[:dependencies]&.empty? end + def specified_dependencies? + options.has_key?(:dependencies) && options[:dependencies].any? + end + def hide_secrets(trace) return unless trace diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index f73902935e6..c8b6450c9b5 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -54,7 +54,7 @@ module Ci # we still have to return 409 in the end, # to make sure that this is properly handled by runner. valid = false - rescue Gitlab::Ci::Error::MissingDependencies + rescue Ci::Build::MissingDependenciesError build.drop!(:missing_dependency_failure) valid = false end |