Skip to content

[Reproducible Builds] Diff in generated/metadata between the builds #23324

Closed
@ihor-sviziev

Description

@ihor-sviziev

It's really important to have Reproducible Builds. It will help to check diff between the builds, so you'll be sure that you deploy only needed changes to production.

Preconditions (*)

  1. Magento 2.2.8 & 2.3.x
  2. Configured Build system on any CI (Bitbucket Pipelines in my case)
  3. When build created - create tar.gz or any other archive and upload it somewhere to make it availabe for downloads later (AWS S3 for instance)

Steps to reproduce (*)

  1. On build system make sure that you're executing php bin/magento setup:di:compile
  2. Execute build preparation multiple times for single commit on two different PCs
  3. Download archives for all builds that you prepared
  4. Unpack archives and compare it with diff -rq ./build-1/ ./build-2/

Expected result (*)

  1. You should have exactly the same results in generated/metadata folders

Actual result (*)

  1. We have diff:
Files build-1/magento2/generated/metadata/crontab.php and build-2/magento2/generated/metadata/crontab.php differ
Files build-1/magento2/generated/metadata/frontend.php and build-2/magento2/generated/metadata/frontend.php differ
Files build-1/magento2/generated/metadata/global.php and build-2/magento2/generated/metadata/global.php differ
Files build-1/magento2/generated/metadata/webapi_rest.php and build-2/magento2/generated/metadata/webapi_rest.php differ
Files build-1/magento2/generated/metadata/webapi_soap.php and build-2/magento2/generated/metadata/webapi_soap.php differ

Additional info

This issue reproducing all the time on Bitbucket Pipelines, but locally I can't reproduce it. I think it caused by using different servers on each build on CI.

If we'll try to compare these files after sorting - they actually the same. I sorted them using following script:

<?php
// Note this method returns a boolean and not the array
function recur_ksort(&$array) {
   foreach ($array as &$value) {
      if (is_array($value)) recur_ksort($value);
   }
   return ksort($array);
}
$result = include 'build-1/magento2/generated/metadata/adminhtml.php';
recur_ksort($result);

echo var_export($result);

Metadata

Metadata

Assignees

Labels

Component: FilesystemFixed in 2.3.xThe issue has been fixed in 2.3 release lineFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions