Commit b831ef71 authored by Lin Jen-Shin's avatar Lin Jen-Shin

They could be nil

parent 755301a2
...@@ -6,9 +6,9 @@ module Gitlab ...@@ -6,9 +6,9 @@ module Gitlab
def build(pipeline) def build(pipeline)
{ {
object_kind: 'pipeline', object_kind: 'pipeline',
user: pipeline.user.hook_attrs, user: pipeline.user.try(:hook_attrs),
project: pipeline.project.hook_attrs(backward: false), project: pipeline.project.hook_attrs(backward: false),
commit: pipeline.commit.hook_attrs, commit: pipeline.commit.try(:hook_attrs),
object_attributes: hook_attrs(pipeline), object_attributes: hook_attrs(pipeline),
builds: pipeline.builds.map(&method(:build_hook_attrs)) builds: pipeline.builds.map(&method(:build_hook_attrs))
} }
...@@ -43,8 +43,8 @@ module Gitlab ...@@ -43,8 +43,8 @@ module Gitlab
finished_at: build.finished_at, finished_at: build.finished_at,
when: build.when, when: build.when,
manual: build.manual?, manual: build.manual?,
user: build.user.hook_attrs, user: build.user.try(:hook_attrs),
runner: runner_hook_attrs(build.runner), runner: build.runner && runner_hook_attrs(build.runner),
artifacts_file: { artifacts_file: {
filename: build.artifacts_file.filename, filename: build.artifacts_file.filename,
size: build.artifacts_size size: build.artifacts_size
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment