diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/data_builder/pipeline.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'lib/gitlab/data_builder/pipeline.rb')
-rw-r--r-- | lib/gitlab/data_builder/pipeline.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/gitlab/data_builder/pipeline.rb b/lib/gitlab/data_builder/pipeline.rb index 385f1e57705..c13bb1d6a9a 100644 --- a/lib/gitlab/data_builder/pipeline.rb +++ b/lib/gitlab/data_builder/pipeline.rb @@ -12,7 +12,7 @@ module Gitlab def initialize(pipeline) @pipeline = pipeline - super( + attrs = { object_kind: 'pipeline', object_attributes: hook_attrs(pipeline), merge_request: pipeline.merge_request && merge_request_attrs(pipeline.merge_request), @@ -23,7 +23,13 @@ module Gitlab preload_builds(pipeline, :latest_builds) pipeline.latest_builds.map(&method(:build_hook_attrs)) end - ) + } + + if pipeline.source_pipeline.present? + attrs[:source_pipeline] = source_pipeline_attrs(pipeline.source_pipeline) + end + + super(attrs) end def with_retried_builds @@ -72,6 +78,20 @@ module Gitlab } end + def source_pipeline_attrs(source_pipeline) + project = source_pipeline.source_project + + { + project: { + id: project.id, + web_url: project.web_url, + path_with_namespace: project.full_path + }, + job_id: source_pipeline.source_job_id, + pipeline_id: source_pipeline.source_pipeline_id + } + end + def merge_request_attrs(merge_request) { id: merge_request.id, |