summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-04-26 21:08:42 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-04-26 21:08:42 +0000
commit22ed1ba34b949f0c0619ea0a94de89ca987a1222 (patch)
tree1c583b22cea6404de37ae6217f320d93cdf7cde9 /lib
parent265b789476479c29ea88db174aca1d80ddf24358 (diff)
parentfe86890b9d7a720648e7570d227c438d6ca7f25a (diff)
downloadgitlab-ce-22ed1ba34b949f0c0619ea0a94de89ca987a1222.tar.gz
Merge branch 'issue-42692-deployment-chat-notifications' into 'master'
Deployment Chat Notifications See merge request gitlab-org/gitlab-ce!27338
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/data_builder/deployment.rb23
-rw-r--r--lib/gitlab/url_builder.rb2
2 files changed, 25 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
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index f86d599e4cb..169ce8ab026 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -30,6 +30,8 @@ module Gitlab
snippet_url(object)
when Milestone
milestone_url(object)
+ when ::Ci::Build
+ project_job_url(object.project, object)
else
raise NotImplementedError.new("No URL builder defined for #{object.class}")
end