summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-08-20 15:19:28 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-08-20 15:19:28 +0000
commit519ffec47d3dc29be96e6ae95157b6582d0b91dd (patch)
tree2aa6d41b8ca8eedaf7b4985ff6754f08746aed99
parent1fb93773915dd77df145ad78ed6197554e5d54a6 (diff)
parent7b2ead6ce85de1b9bd5fb05a01239891a287e094 (diff)
downloadgitlab-ce-519ffec47d3dc29be96e6ae95157b6582d0b91dd.tar.gz
Merge branch 'master' into 'master'
#47845 - Propagate failure_reason to job webhook See merge request gitlab-org/gitlab-ce!21143
-rw-r--r--changelogs/unreleased/47845-propagate_failure_reason-to-job-webhook.yml5
-rw-r--r--doc/user/project/integrations/webhooks.md1
-rw-r--r--lib/gitlab/data_builder/build.rb1
-rw-r--r--spec/lib/gitlab/data_builder/build_spec.rb1
4 files changed, 8 insertions, 0 deletions
diff --git a/changelogs/unreleased/47845-propagate_failure_reason-to-job-webhook.yml b/changelogs/unreleased/47845-propagate_failure_reason-to-job-webhook.yml
new file mode 100644
index 00000000000..3f85f75bef4
--- /dev/null
+++ b/changelogs/unreleased/47845-propagate_failure_reason-to-job-webhook.yml
@@ -0,0 +1,5 @@
+---
+title: "#47845 Add failure_reason to job webhook"
+merge_request: 21143
+author: matemaciek
+type: added
diff --git a/doc/user/project/integrations/webhooks.md b/doc/user/project/integrations/webhooks.md
index 77fa517b5b1..770b1810da1 100644
--- a/doc/user/project/integrations/webhooks.md
+++ b/doc/user/project/integrations/webhooks.md
@@ -1102,6 +1102,7 @@ X-Gitlab-Event: Build Hook
"build_finished_at": null,
"build_duration": null,
"build_allow_failure": false,
+ "build_failure_reason": "script_failure",
"project_id": 380,
"project_name": "gitlab-org/gitlab-test",
"user": {
diff --git a/lib/gitlab/data_builder/build.rb b/lib/gitlab/data_builder/build.rb
index 2f1445a050a..0b71b31a476 100644
--- a/lib/gitlab/data_builder/build.rb
+++ b/lib/gitlab/data_builder/build.rb
@@ -28,6 +28,7 @@ module Gitlab
build_finished_at: build.finished_at,
build_duration: build.duration,
build_allow_failure: build.allow_failure,
+ build_failure_reason: build.failure_reason,
# TODO: do we still need it?
project_id: project.id,
diff --git a/spec/lib/gitlab/data_builder/build_spec.rb b/spec/lib/gitlab/data_builder/build_spec.rb
index ee91decafad..14fe196a986 100644
--- a/spec/lib/gitlab/data_builder/build_spec.rb
+++ b/spec/lib/gitlab/data_builder/build_spec.rb
@@ -15,6 +15,7 @@ describe Gitlab::DataBuilder::Build do
it { expect(data[:build_id]).to eq(build.id) }
it { expect(data[:build_status]).to eq(build.status) }
it { expect(data[:build_allow_failure]).to eq(false) }
+ it { expect(data[:build_failure_reason]).to eq(build.failure_reason) }
it { expect(data[:project_id]).to eq(build.project.id) }
it { expect(data[:project_name]).to eq(build.project.full_name) }