diff options
author | Jason Goodman <jgoodman@gitlab.com> | 2019-04-27 00:08:41 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-27 00:08:41 +0300 |
commit | fe86890b9d7a720648e7570d227c438d6ca7f25a (patch) | |
tree | 1c583b22cea6404de37ae6217f320d93cdf7cde9 /lib/gitlab/data_builder | |
parent | 265b789476479c29ea88db174aca1d80ddf24358 (diff) |
Add deployment events to chat notification services
This enables sending a chat message to Slack or Mattermost
upon a successful, failed, or canceled deployment
Diffstat (limited to 'lib/gitlab/data_builder')
-rw-r--r-- | lib/gitlab/data_builder/deployment.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/data_builder/deployment.rb b/lib/gitlab/data_builder/deployment.rb new file mode 100644 index 00000000000..26705dd1f6f --- /dev/null +++ b/lib/gitlab/data_builder/deployment.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Gitlab + module DataBuilder + module Deployment + extend self + + def build(deployment) + { + object_kind: 'deployment', + status: deployment.status, + deployable_id: deployment.deployable_id, + deployable_url: Gitlab::UrlBuilder.build(deployment.deployable), + environment: deployment.environment.name, + project: deployment.project.hook_attrs, + short_sha: deployment.short_sha, + user: deployment.user.hook_attrs, + commit_url: Gitlab::UrlBuilder.build(deployment.commit) + } + end + end + end +end |