summaryrefslogtreecommitdiff
path: root/app/serializers/pipeline_entity.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-10 17:53:42 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-10 17:53:42 +0200
commit741fb49378abbf66fbd8d6ad27b94f1040bf3123 (patch)
tree6bc2393e7fd3d8733e0ef8a19c98bd16d2b4fdbd /app/serializers/pipeline_entity.rb
parente678f312923faf9a702e19894175d4cb14f66b5b (diff)
parent9ac5338b8eb361927ad068486398b92acb0c287e (diff)
downloadgitlab-ce-741fb49378abbf66fbd8d6ad27b94f1040bf3123.tar.gz
Merge branch 'master' into bvl-group-trees
Diffstat (limited to 'app/serializers/pipeline_entity.rb')
-rw-r--r--app/serializers/pipeline_entity.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb
index 357fc71f877..6457294b285 100644
--- a/app/serializers/pipeline_entity.rb
+++ b/app/serializers/pipeline_entity.rb
@@ -20,6 +20,7 @@ class PipelineEntity < Grape::Entity
expose :has_yaml_errors?, as: :yaml_errors
expose :can_retry?, as: :retryable
expose :can_cancel?, as: :cancelable
+ expose :failure_reason?, as: :failure_reason
end
expose :details do
@@ -44,6 +45,11 @@ class PipelineEntity < Grape::Entity
end
expose :commit, using: CommitEntity
+ expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? }
+
+ expose :failure_reason, if: -> (pipeline, _) { pipeline.failure_reason? } do |pipeline|
+ pipeline.present.failure_reason
+ end
expose :retry_path, if: -> (*) { can_retry? } do |pipeline|
retry_project_pipeline_path(pipeline.project, pipeline)
@@ -53,8 +59,6 @@ class PipelineEntity < Grape::Entity
cancel_project_pipeline_path(pipeline.project, pipeline)
end
- expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? }
-
private
alias_method :pipeline, :object