debian-mirror-gitlab/lib/gitlab/data_builder/deployment.rb

35 lines
1.1 KiB
Ruby
Raw Normal View History

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),
2022-03-02 08:16:31 +05:30
commit_title: deployment.commit.title,
ref: deployment.ref
2019-07-31 22:56:46 +05:30
}
end
end
end
end