2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module DataBuilder
|
|
|
|
module Deployment
|
|
|
|
extend self
|
|
|
|
|
|
|
|
def build(deployment)
|
2019-12-26 22:10:19 +05:30
|
|
|
# Deployments will not have a deployable when created using the API.
|
|
|
|
deployable_url =
|
|
|
|
if deployment.deployable
|
|
|
|
Gitlab::UrlBuilder.build(deployment.deployable)
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
{
|
|
|
|
object_kind: 'deployment',
|
|
|
|
status: deployment.status,
|
|
|
|
deployable_id: deployment.deployable_id,
|
2019-12-26 22:10:19 +05:30
|
|
|
deployable_url: deployable_url,
|
2019-07-31 22:56:46 +05:30
|
|
|
environment: deployment.environment.name,
|
|
|
|
project: deployment.project.hook_attrs,
|
|
|
|
short_sha: deployment.short_sha,
|
|
|
|
user: deployment.user.hook_attrs,
|
|
|
|
user_url: Gitlab::UrlBuilder.build(deployment.user),
|
|
|
|
commit_url: Gitlab::UrlBuilder.build(deployment.commit),
|
|
|
|
commit_title: deployment.commit.title
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|