Class: Atlassian::JiraConnect::Serializers::DeploymentEntity
- Inherits:
-
Grape::Entity
- Object
- Grape::Entity
- Atlassian::JiraConnect::Serializers::DeploymentEntity
show all
- Includes:
- Gitlab::Routing, Gitlab::Utils::StrongMemoize
- Defined in:
- lib/atlassian/jira_connect/serializers/deployment_entity.rb
Constant Summary
collapse
- COMMITS_LIMIT =
2000
- ISSUE_KEY_LIMIT =
500
- ASSOCIATION_LIMIT =
500
Instance Method Summary
collapse
includes_helpers, redirect_legacy_paths, url_helpers
Instance Method Details
#associations ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/atlassian/jira_connect/serializers/deployment_entity.rb', line 35
def associations
keys = issue_keys
commits = commits_since_last_deploy.first(ASSOCIATION_LIMIT)
merge_requests = deployment.deployment_merge_requests.first(ASSOCIATION_LIMIT)
repository_id = project.id.to_s
combined_associations = service_ids_from_integration_configuration
combined_associations << { associationType: :issueKeys, values: keys } if keys.present?
if commits.present?
commit_objects = commits.map { |commit| { commitHash: commit.id, repositoryId: repository_id } }
combined_associations << { associationType: :commit, values: commit_objects }
end
if merge_requests.present?
mr_objects = merge_requests.map do |mr|
{ pullRequestId: mr.merge_request_id, repositoryId: repository_id }
end
combined_associations << { associationType: 'pull-request', values: mr_objects }
end
combined_associations.presence
end
|
#issue_keys ⇒ Object
30
31
32
33
|
# File 'lib/atlassian/jira_connect/serializers/deployment_entity.rb', line 30
def issue_keys
@issue_keys ||= (issue_keys_from_pipeline + issue_keys_from_commits_since_last_deploy)
.uniq.first(ISSUE_KEY_LIMIT)
end
|