2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module DataBuilder
|
|
|
|
module Deployment
|
|
|
|
extend self
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def build(deployment, status_changed_at)
|
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,
|
2021-06-08 01:23:25 +05:30
|
|
|
status_changed_at: status_changed_at,
|
2021-10-27 15:23:28 +05:30
|
|
|
deployment_id: deployment.id,
|
2019-07-31 22:56:46 +05:30
|
|
|
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,
|
2021-01-03 14:25:43 +05:30
|
|
|
user: deployment.deployed_by.hook_attrs,
|
|
|
|
user_url: Gitlab::UrlBuilder.build(deployment.deployed_by),
|
2019-07-31 22:56:46 +05:30
|
|
|
commit_url: Gitlab::UrlBuilder.build(deployment.commit),
|
|
|
|
commit_title: deployment.commit.title
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|