summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 12:07:43 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 12:07:43 +0000
commitd10a462fedbd7794a83abdba9b4526600f71de5b (patch)
tree4dbd21cb89013d9e07b05bac5101cd13585a8be5 /lib/gitlab/ci/pipeline
parent13867d66e92c2fd8962a126db4fbdc32891343c9 (diff)
downloadgitlab-ce-d10a462fedbd7794a83abdba9b4526600f71de5b.tar.gz
Add latest changes from gitlab-org/gitlab@masterogolowinski-master-patch-80898
Diffstat (limited to 'lib/gitlab/ci/pipeline')
-rw-r--r--lib/gitlab/ci/pipeline/chain/config/process.rb2
-rw-r--r--lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb20
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/config/process.rb b/lib/gitlab/ci/pipeline/chain/config/process.rb
index feb5b4556e1..09d1b0edc93 100644
--- a/lib/gitlab/ci/pipeline/chain/config/process.rb
+++ b/lib/gitlab/ci/pipeline/chain/config/process.rb
@@ -21,7 +21,7 @@ module Gitlab
rescue Gitlab::Ci::YamlProcessor::ValidationError => ex
error(ex.message, config_error: true)
rescue => ex
- Gitlab::Sentry.track_exception(ex,
+ Gitlab::ErrorTracking.track_exception(ex,
project_id: project.id,
sha: @pipeline.sha
)
diff --git a/lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb b/lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb
index 0ee9485eebc..81f5733b279 100644
--- a/lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb
+++ b/lib/gitlab/ci/pipeline/chain/evaluate_workflow_rules.rb
@@ -9,7 +9,13 @@ module Gitlab
include Chain::Helpers
def perform!
- return unless Feature.enabled?(:workflow_rules, @pipeline.project)
+ unless feature_enabled?
+ if has_workflow_rules?
+ error("Workflow rules are disabled", config_error: true)
+ end
+
+ return
+ end
unless workflow_passed?
error('Pipeline filtered out by workflow rules.')
@@ -17,13 +23,15 @@ module Gitlab
end
def break?
- return false unless Feature.enabled?(:workflow_rules, @pipeline.project)
-
- !workflow_passed?
+ @pipeline.errors.any? || @pipeline.persisted?
end
private
+ def feature_enabled?
+ Feature.enabled?(:workflow_rules, @pipeline.project, default_enabled: true)
+ end
+
def workflow_passed?
strong_memoize(:workflow_passed) do
workflow_rules.evaluate(@pipeline, global_context).pass?
@@ -40,6 +48,10 @@ module Gitlab
@pipeline, yaml_variables: workflow_config[:yaml_variables])
end
+ def has_workflow_rules?
+ workflow_config[:rules].present?
+ end
+
def workflow_config
@command.config_processor.workflow_attributes || {}
end