What happened?
Description
I'm still seeing the issue described in #15012. I can't reliably reproduce it, but sometimes, running up or project-config/apply will not apply the config, but will instead reset the config to an earlier state (essentially running project-config/write).
I've encountered this in two scenarios:
- When switching between branches with different config states in a local dev environment (in
dev mode with allowAdminChanges set to true).
- When deploying to a live server (in
production mode with allowAdminChanges set to false).
Not sure if those are the same issue, or two unrelated issues.
I don't know what causes this or how to reproduce it. Just now I saw this while deploying an update from Craft 4 to Craft 5. The environment doesn't allow admin changes, and the deployment script only applies the most recent state from GitHub, here's the relevant part:
# Flush all caches
$FORGE_PHP craft cache/flush-all --interactive=0
$FORGE_PHP craft clear-caches/all --interactive=0
# Update source code from repository
git pull --ff-only origin $FORGE_SITE_BRANCH
# Install Composer dependencies
$FORGE_COMPOSER install --no-dev --no-progress --no-interaction --prefer-dist --optimize-autoloader
# Apply project config and any pending migrations
$FORGE_PHP craft migrate/all --no-content --interactive=0
$FORGE_PHP craft project-config/apply
$FORGE_PHP craft migrate --track=content --interactive=0
Now I can see in the deployment log that the Composer installation ran successfully, and the first set of migrations (before the project-config/apply step) were also executed correctly. But after that, the project-config/apply command resulted in an error:
29 migrations were applied.
Migrated up successfully.
Your project config files were created for different versions of Craft and/or plugins than what’s currently installed.
Craft CMS is installed with schema version of 5.3.0.2 while 4.5.3.0 was expected.
Navigation is installed with schema version of 2.1.0 while 2.0.7 was expected.
Super Table is installed with schema version of 4.0.0 while 3.0.0 was expected.
Try running `composer install` from your terminal to resolve.
Checking the files on the server, I could see that the config/ folder was reset to the state before the deployment started. After running git reset --hard and git clean -df, I restarted the deployment. This time, it finished successfully.
So something caused Craft to write out the existing config instead of applying it. Either as part of the migrate/all --no-content step, or at the beginning of the project-config/apply step.
Steps to reproduce
Unclear.
Expected behavior
- Running
project-config/apply should never, in any circumstances, change any files in the config/ folder. If the config can't be applied for any reason, it should throw an error, and possibly advice on how to fix the issue.
- While
allowAdminChanges is set to false, Craft should never, ever write anything to the config/ folder.
Actual behavior
In some situations, running up or project-config/apply will have unexpectedly revert the config to the current state in the database, acting like project-config/write.
Craft CMS version
5.4.10
PHP version
8.3
Operating system and version
No response
Database type and version
MySQL 8
Image driver and version
No response
Installed plugins and versions
No response
What happened?
Description
I'm still seeing the issue described in #15012. I can't reliably reproduce it, but sometimes, running
uporproject-config/applywill not apply the config, but will instead reset the config to an earlier state (essentially runningproject-config/write).I've encountered this in two scenarios:
devmode withallowAdminChangesset totrue).productionmode withallowAdminChangesset tofalse).Not sure if those are the same issue, or two unrelated issues.
I don't know what causes this or how to reproduce it. Just now I saw this while deploying an update from Craft 4 to Craft 5. The environment doesn't allow admin changes, and the deployment script only applies the most recent state from GitHub, here's the relevant part:
Now I can see in the deployment log that the Composer installation ran successfully, and the first set of migrations (before the
project-config/applystep) were also executed correctly. But after that, theproject-config/applycommand resulted in an error:Checking the files on the server, I could see that the
config/folder was reset to the state before the deployment started. After runninggit reset --hardandgit clean -df, I restarted the deployment. This time, it finished successfully.So something caused Craft to write out the existing config instead of applying it. Either as part of the
migrate/all --no-contentstep, or at the beginning of theproject-config/applystep.Steps to reproduce
Unclear.
Expected behavior
project-config/applyshould never, in any circumstances, change any files in theconfig/folder. If the config can't be applied for any reason, it should throw an error, and possibly advice on how to fix the issue.allowAdminChangesis set tofalse, Craft should never, ever write anything to theconfig/folder.Actual behavior
In some situations, running
uporproject-config/applywill have unexpectedly revert the config to the current state in the database, acting likeproject-config/write.Craft CMS version
5.4.10
PHP version
8.3
Operating system and version
No response
Database type and version
MySQL 8
Image driver and version
No response
Installed plugins and versions
No response