Problem/Motivation
We have a script that converts our module into a core merge request but it has not been update or ran in long time
It was used to create the commits on #3253158: Add Alpha level Experimental Update Manager module
but since we are now planning to first do an MR just for Package Manager it will need to be updated.
We can test it here #2977515: [ignore] Test Package manager core merge
Steps to reproduce
Proposed resolution
Conversion script changes
-
https://www.drupal.org/pift-ci-job/2596238
Since Automatic UPdates tests rely package manager test fixtures but the folders are in the same parent directory we need to somehow automatically fix things like this
1) Drupal\Tests\auto_updates\Functional\AvailableUpdatesReportTest::testReportLinks Failed asserting that file "/var/www/html/core/modules/auto_updates/tests/src/Functional/../../../package_manager/tests/fixtures/release-history/drupal.9.8.2.xml" exists. /var/www/html/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122 /var/www/html/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /var/www/html/core/modules/auto_updates/tests/src/Functional/AutoUpdatesFunctionalTestBase.php:145 /var/www/html/core/modules/auto_updates/tests/src/Functional/AutoUpdatesFunctionalTestBase.php:73 /var/www/html/core/tests/Drupal/Tests/BrowserTestBase.php:545 /var/www/html/core/tests/Drupal/Tests/BrowserTestBase.php:364 /var/www/html/core/modules/auto_updates/tests/src/Functional/AutoUpdatesFunctionalTestBase.php:55 /var/www/html/core/modules/auto_updates/tests/src/Functional/AvailableUpdatesReportTest.php:35 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 -
Per @catch ComposerFixtureCreator should be moved core/scripts. This means we should also make ComposerFixtureCreator run without changes needed to composer.json so we don't have to update core's composer.json. At least while the module is alpha maybe we could later but really not needed.
How to run the conversion
- checkout this repo to the MR branch - 3341974-convert-script
- In a different directory make a clone for Drupal core and checkout the MR branch, 2977515-package-manager-mr , from #2977515: [ignore] Test Package manager core merge
- from the base of the Automatic Updates repo from 1) run
composer core-convert /path/to/core/clone 2977515-package-manager-mr 3341974-convert-script - If the script was succesful it should have made a new commit on the core clone
- Push the new commit, like any other MR commit
- Wait and check the test run on #2977515: [ignore] Test Package manager core merge
- Find test failures you can fix by making changes to AutoUpdates repo, can do simple ones in this issue, larger ones will need their own issue. For small changes on this issue we can make incremental merges into 3.0.x, ping @tedbow about this
Changes made to
scripts/src/Converter.phpcan wait till the next merge as no other issue should be working on this file
Changes to other are probably easier to merge in often to 3.0.x because other issue will be editing those files - Go back to step 3
How update to update our dependencies
The script does not add or update our composer dependencies that we need to add to core. this is done manually on the core merge request
see https://www.drupal.org/about/core/policies/core-dependency-policies/mana...
Issue fork automatic_updates-3341974
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tedbowComment #3
wim leersAdded to #3319030: Drupal Core Roadmap for Package Manager and Update Manager 👍
Comment #5
tedbowComment #6
tedbowComment #7
tedbowComment #8
wim leersExciting that this is happening!!!!!!!! 🤩
That path is wrong. Because it assumes that the
package_managermodule still lives inside of theauto_updatesmodule, which it does not.composer/Metapackage/PinnedDevDependencies/composer.jsontocomposer/Metapackage/CoreRecommended/composer.json— that seems wrong?Converterand one actual bug.Comment #9
wim leers#3342120: Fix PHPStan violations (happened because PHPStan code checks stopped running…) is green and will soon be merged. That will allow you to remove the hack to avoid PHPStan complaints. 👍
Yesterday you had a proposal for how to deal with #8.1. I can't remember it though. Can you write it here?
Finally: my work on
cspellin #3343430: Stop reusing core's commit-code-check.sh in favor of 4 simple commands has made it clear that we actually need twodictionary.txts, one for each module — because the core MR will be forpackage_maangeronly.Comment #10
wim leers#3342120: Fix PHPStan violations (happened because PHPStan code checks stopped running…) also landed! This now can definitely move forward.
Comment #11
wim leersAfter a failed attempt, do this in the core checkout:
rm -rf core/modules/package_manager && git checkout -- core && cd core && yarn install && cd ..Let's see if the new MR is green: #2977515-291: [ignore] Test Package manager core merge — test results at https://www.drupal.org/pift-ci-job/2608719 😬.
Comment #12
tedbowComment #13
wim leersComment #14
wim leerseagerly awaiting results of:
👆
That takes ~1 hour to run, I’m going for a run in the mean time. Assuming that’s green, I’ll take those results and transplant them onto #3346707: Add Alpha level Experimental Package Manager module, and then we should a true green core MR! 🤓
Comment #15
wim leersOops 😅 This is what I meant to do!
Awaiting resuls…
Comment #16
wim leersUgh, the March 3 one passed thanks to @tedbow's fixes … but he didn't push them up to this branch! 😬 For example:
… and on that note, it looks like he actually had already solved what I just fixed in a different way: https://git.drupalcode.org/project/drupal/-/merge_requests/3578/diffs?co... … ← also not pushed 😢
So I'm going to update the core MR at 3346707 manually, rather than spending more time on a Friday night re-creating what @tedbow already has working locally…
Comment #17
wim leersBTW, there are a few more things that should not be added to Drupal core, such as
package_manager_update_9001(). I suggest we add the necessaryand
comments in this MR too, so that once this MR is merged, we're 100% satisfied with the MR it generates.
Comment #18
tedbow@Wim Leers, this MR should be green and I used it to convert the module to this green core merge request https://www.drupal.org/project/drupal/issues/3346707#mr3608-note158604 on #3346707: Add Alpha level Experimental Package Manager module
I created #3347937: ComposerFixtureCreator need to move and updated for core merge request as a follow-up. I think this could be a beta-target
Comment #19
wim leersLooking great! But I don't think I agree with #18. Quoting what I wrote at #3347937-3: ComposerFixtureCreator need to move and updated for core merge request:
Comment #20
wim leersAnd I think this should also do #3318298: Add Composer Stager to Core vendor hardening config, since there's no point to do it as a separate issue. Or … is that because until Package Manager reaches
beta-experimental, Drupal core will remove both the PM module as well as Composer Stager out of packaged builds, and that's why #3318298: Add Composer Stager to Core vendor hardening config needs to be postponed? 🤔 Unclear to me at this time.Comment #22
tedbowMerged the current MR in to 3.0.x so we have an easy way to convert 3.0.x to the core merge request.
pre #19 I will close #3347937: ComposerFixtureCreator need to move and updated for core merge request as a duplicate and we need to make another MR for that in this issue and add the scope to the summary
Comment #23
tedbowComment #25
tedbowchatted with @catch https://drupal.slack.com/archives/C7QJNEY3E/p1678889303046529?thread_ts=...
Just going to move ComposerFixtureCreator into core/scripts.
Comment #26
tedbowThis now moves PackageManagerFixtureCreator to core/scripts.
Assigning to @Wim Leers to review
To test:
php ./core/scripts/PackageManagerFixtureCreator.phpfrom the base of core clone you are converting into.git diffyou should only see"reference":changes incore/modules/package_manager/tests/fixtures/fake_sitewhen these changes are good I suggest we merge the current changes into 3.0.x again. We can keep this issue open because we will likely have little changes we need to make to the conversion script until we are done using it. Or could just close and re-open if/when needed
Comment #27
tedbow@Wim Leers re https://git.drupalcode.org/project/automatic_updates/-/merge_requests/78...
I undid some changes I made to replace all
static::withself::in thePackageManagerFixtureCreator. It made the diff much bigger.We should probably fix this here though to consistent before the file is in core. But figured you can review only the needed changes first. If you want to merge these changes feel free, can also do the replacement
static::withself::in thePackageManagerFixtureCreatorif you wantComment #29
wim leers#25: nice!
#26: once core MR is green including the fixture creator, I don't think is necessary — we can just commit whatever changes we need directly without the need for an issue IMHO — the commit message should just explain what we're doing. Because none of those commits would be making semantical changes to the logic of Package Manager itself, only to the script. And the script is just a tool to bring it into core, not an essential part of the module — issue queue hygiene/git archeology is pretty much non-important for it!
#27:
selfvsstaticin the context of this stand-alone script … is super unimportant IMHO 🥸This looks great now! I trust that this results in a working core MR because adding a script cannot affect the test outcome. So … merged 🚢