Problem/Motivation
To test users with cron update for contrib we should make an experimental cron updater for contrib modules in automatic_updates_extensions
Proposed resolution
In the current issue would should make the very basic version
- The version of the update that is added in this issue maybe incomplete so I have set the config needed to turn in it to start with
PLEASE_BREAK_MY_SITE_.
Remaining tasks
Follow-ups before MVP testing
- A 'deny list' config to be set in settings.php(no UI) that would allow opting out certain modules from cron updates
Issue fork automatic_updates-3355446
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 #4
tedbowComment #5
wim leersThis is already fairly big. And it's not yet done.
IMHO we should extract
into a separate issue. Based on @tedbow's comment at https://git.drupalcode.org/project/automatic_updates/-/merge_requests/84..., I see no reason why that would not be possible?
Comment #6
wim leersAfter this lands, we should tackle #3355620: [PP-1] Pave the path for contrib updates: automatically limit the staged updates to those modules without DB updates.
Comment #7
tedbowComment #8
tedbowI talked to @omkar.podey a while ago about working on this
Comment #10
phenaproxima@omkar.podey asked me to look at this to figure out why tests are failing for him.
When I ran
\Drupal\Tests\automatic_updates_extensions\Kernel\CronExtensionUpdateStageTest::testUpdateStageCalled, this is what I got:TypeError : Double\EventDispatcherInterface\P1::dispatch(): Return value must be of type object, null returnedThis makes absolute perfect sense. When routes are rebuilt, the event dispatcher is invoked by the routing system. That, as far as I know, is how routes are collected in the first place.
But, immediately before the test runs cron, it does this:
No wonder our fake event dispatcher here is not cutting the mustard -- the system expects the event dispatcher to be functional, but we just replaced it with a fake thing.
What we should probably do here is, rather than replace the event dispatcher entirely, we should simply disable all subscribers to Package Manager's events. It'll be a pain, but we could do it with
\Symfony\Component\EventDispatcher\EventDispatcherInterface::getListenersand\Symfony\Component\EventDispatcher\EventDispatcherInterface::removeListener.Comment #11
wim leersDiscussed during a meeting just now. Next steps here:
Comment #12
phenaproximaThis is going to require a thorough top-down review of the entire AUE module from me, to generate this list of questions. When all tests are written and passing, assign this issue to me to do that.
A little expansion on what this should entail: it should create a test site with three installed contrib extensions (two modules and a theme). The theme, and one of the modules, should have available updates; the other module shouldn't. The things with updates should get updated during cron; the other thing should be unchanged.
Comment #13
omkar.podey commentedTests are all green now, now working on handling multiple contrib module updates at once.
Comment #14
omkar.podey commentedAlso for now without the release chooser we are looking at the
recommendedkey for target release.Comment #15
wim leers#12: Thanks for elaborating 🙏😊
#13: Great! 🚀
#14: That sounds fine! 👍
Comment #16
omkar.podey commentedSo the problem right now is that i. don't think the logger is working properly, because i can't see the message being logged from
modules/contrib/automatic_updates/automatic_updates_extensions/src/CronExtensionUpdateStage.php:371.I was trying to observe logs at
modules/contrib/automatic_updates/automatic_updates_extensions/tests/src/Build/CronModuleUpdateTest.php:134.i have some file put contents which i have commented for now to see if all the methods are called as i expect them to be, which are in the pattern
file_put_contents('/Users/omkar.podey/Comment #17
omkar.podey commentedassigning to @ted.bow for the logger.
Comment #18
tedbow@omkar.podey I look at this a little but didn't have time to figure it out.
I push 1 commit that will let you run the build test but exit early with a drupal site built that you can use afterwards to just run cron manually and use xdebug to investigate further.
Comment #19
tedbowComment #20
wim leersAFAICT #3355628 would also simplify the writing of the build test for this issue, because there's better information to act on after the build test fails. See #3355628-12: Package Manager should keep an audit log of changes it applied to the active codebase.
Comment #21
omkar.podey commentedThe url for release history needs to be replaced while using the build test project, so it's able to get the alpha module release history.
$config['update.settings']['fetch']['url'] = 'http://temp.test/build-temp/test-release-history';---> to be changed insettings.phpComment #22
wim leers@tedbow mentioned in Slack:
Reflecting that.
Comment #23
wim leersCrediting myself for https://git.drupalcode.org/project/automatic_updates/-/merge_requests/84... — which I discovered while pairing with @omkar.podey for ~2.5 hours yesterday 🤠
The
update_test.settingsconfig override caused Drupal to think that it was always version1.0.0of thealphamodule that was installed, even after updating!Comment #24
omkar.podey commentedSo i got to test the build test project and the module is getting updated but the
handlePostApplyisn't getting called as the curl is failing intriggerPostApply.Comment #25
tedbowPostponed on #3360656: For web cron updates run each stage life cycle phase in a different request which is going to re-write unattended updates