Fix import/export for CI partitioning

Exporting and importing a project changes the partition_id on the p_ci_builds_metadata records to the wrong value:

gitlabhq_development_ci=# select count(*) from ci_builds where project_id = 27;
 count
-------
  2700
(1 row)

gitlabhq_development_ci=# select count(*) from ci_builds where project_id = 27 and partition_id = 101;
 count
-------
     0
(1 row)

gitlabhq_development_ci=# select count(*) from p_ci_builds_metadata where partition_id = 101;
 count
-------
  2700
(1 row)

When we export builds, we don't export the metadata relation, but call the accessors on build to get the values. When we import it back, we fallback on building the metadata record to set the data, but partition_id for the metadatabale record comes from the database since it was not validated yet, meaning:

build.yaml_variables = something
# is translated into
build.build_metadata(project: build.project, partition_id: build.partition_id).yaml_variables = something

More details: #387301 (comment 1236757887)

Edited by Marius Bobin