fix export performance of CI builds
This commit is contained in:
parent
be99f82478
commit
4119206f76
|
@ -451,6 +451,10 @@ module Ci
|
|||
trace
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
super(options.merge(when: read_attribute(:when)))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_artifacts_size
|
||||
|
|
|
@ -116,6 +116,7 @@ excluded_attributes:
|
|||
statuses:
|
||||
- :trace
|
||||
- :token
|
||||
- :when
|
||||
push_event_payload:
|
||||
- :event_id
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@ module Gitlab
|
|||
attributes = @attributes_finder.find(:project)
|
||||
project_attributes = attributes.is_a?(Hash) ? attributes[:project] : {}
|
||||
|
||||
build_hash(@tree).each do |sub_hash|
|
||||
yield(project_attributes.merge(include: sub_hash))
|
||||
end
|
||||
project_attributes.merge(include: build_hash(@tree))
|
||||
rescue => e
|
||||
@shared.error(e)
|
||||
false
|
||||
|
|
|
@ -117,6 +117,13 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
expect(saved_project_json['pipelines'].first['statuses'].count { |hash| hash['type'] == 'Ci::Build' }).to eq(1)
|
||||
end
|
||||
|
||||
it 'builds do not call the attributes for retrieving when' do
|
||||
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return(File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')))
|
||||
expect_any_instance_of(Ci::GitlabCiYamlProcessor).not_to receive(:build_attributes)
|
||||
|
||||
saved_project_json
|
||||
end
|
||||
|
||||
it 'has pipeline commits' do
|
||||
expect(saved_project_json['pipelines']).not_to be_empty
|
||||
end
|
||||
|
@ -251,15 +258,11 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
create(:label_priority, label: group_label, priority: 1)
|
||||
milestone = create(:milestone, project: project)
|
||||
merge_request = create(:merge_request, source_project: project, milestone: milestone)
|
||||
commit_status = create(:commit_status, project: project)
|
||||
|
||||
ci_pipeline = create(:ci_pipeline,
|
||||
project: project,
|
||||
sha: merge_request.diff_head_sha,
|
||||
ref: merge_request.source_branch,
|
||||
statuses: [commit_status])
|
||||
ci_build = create(:ci_build, project: project, when: nil)
|
||||
ci_build.pipeline.update(project: project)
|
||||
commit_status = create(:commit_status, project: project, pipeline: ci_build.pipeline)
|
||||
|
||||
create(:ci_build, pipeline: ci_pipeline, project: project)
|
||||
create(:milestone, project: project)
|
||||
create(:note, noteable: issue, project: project)
|
||||
create(:note, noteable: merge_request, project: project)
|
||||
|
@ -267,7 +270,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
create(:note_on_commit,
|
||||
author: user,
|
||||
project: project,
|
||||
commit_id: ci_pipeline.sha)
|
||||
commit_id: ci_build.pipeline.sha)
|
||||
|
||||
create(:event, :created, target: milestone, project: project, author: user)
|
||||
create(:service, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker')
|
||||
|
|
Loading…
Reference in New Issue