Commit 1d3b2bf7 authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-fix-project-import-commit-status' into 'master'

Fix project imports not working with serialized data

Closes #34860

See merge request gitlab-org/gitlab!19124
parents 52b1da05 8aebc174
---
title: Fix project imports not working with serialized data
merge_request: 19124
author:
type: fixed
......@@ -292,9 +292,11 @@ module Gitlab
existing_object
else
object = relation_class.new
# Use #assign_attributes here to call object custom setters
# Because of single-type inheritance, we need to be careful to use the `type` field
# See https://gitlab.com/gitlab-org/gitlab/issues/34860#note_235321497
inheritance_column = relation_class.try(:inheritance_column)
inheritance_attributes = parsed_relation_hash.slice(inheritance_column)
object = relation_class.new(inheritance_attributes)
object.assign_attributes(parsed_relation_hash)
object
end
......
......@@ -6226,7 +6226,9 @@
"job_id": null,
"name": "test build 1",
"deploy": false,
"options": null,
"options": {
"image": "busybox:latest"
},
"allow_failure": false,
"stage": "test",
"trigger_request_id": null,
......
......@@ -283,6 +283,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
it 'correctly restores association between a pipeline and a job' do
expect(CommitStatus.all).to all(have_attributes(pipeline_id: a_value > 0))
end
it 'restores a Hash for CommitStatus options' do
expect(CommitStatus.all.map(&:options).compact).to all(be_a(Hash))
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment