Module: Gitlab::DataBuilder::Deployment

Extended by:
Deployment
Included in:
Deployment
Defined in:
lib/gitlab/data_builder/deployment.rb

Instance Method Summary collapse

Instance Method Details

#build(deployment) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitlab/data_builder/deployment.rb', line 8

def build(deployment)
  # Deployments will not have a deployable when created using the API.
  deployable_url =
    if deployment.deployable
      Gitlab::UrlBuilder.build(deployment.deployable)
    end

  {
    object_kind: 'deployment',
    status: deployment.status,
    deployable_id: deployment.deployable_id,
    deployable_url: deployable_url,
    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