Use ignore settings of the target storage if the config ignore config is ignored

Created on 11 March 2024, 8 months ago
Updated 25 April 2024, 7 months ago

Problem/Motivation

Under version 2.x of the Config Ignore module, the behavior during configuration imports was in line with the specifications set in the module's admin interface. Specifically, configurations were ignored as per the defined rules in the admin interface.

However, with version 3.x, I've observed a difference in behavior. During configuration imports using drush cim, the module seems to ignore configurations based solely on the rules defined in the config_ignore.settings.yml file, disregarding the settings specified in the admin interface.

As a site administrator, I'd expect that if I add a block configuration to the config ignore settings on a website, it won't be overwritten on the next deployment on that environment.

On the other hand, when exporting configurations with drush cex, the module correctly adheres to the rules set in the admin interface for ignoring configurations, and won't export those.

Expected Behavior:

I would expected the behavior during configuration imports to be consistent with the settings in the admin interface, as it was in version 2.x ?

That is:

  • I make a change to the website: I don't want this change to be overwritten by a default value on the next code deployment.
  • I add the config to be ignored using the site interface.
  • A code deployment is applied to the site.
  • The configuration I applied earlier is still in place.

Documentation Checked:

I have consulted the module documentation, but it does not explicitly address this specific behavior difference between version 2.x and 3.x ?

Additional Information:

This behavior difference has implications for configuration management workflows, and I'm seeking clarification on whether this is an intended change in version 3.x or if there is a configuration adjustment I may have overlooked? Any insights or recommendations from the community would be greatly appreciated.

Thanks for your help!

๐Ÿ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ฆCanada julienr Montrรฉal, QC

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @julienr
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada julienr Montrรฉal, QC
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland bircher ๐Ÿ‡จ๐Ÿ‡ฟ

    Yes this is on purpose ๐Ÿ› Use ignore settings from storage being transformed if they exist Fixed Because otherwise you can not deploy it at the same time as a change to the config ignore settings.

    However this doesn't work if you are ignoring the config ignore settings too. So there is still something we should do.
    Now if we would check the settings in the target storage (ie when importing the config that would be the active site config) and if the config ignore config is ignored then we use that instead this would solve the issue for you. But then it wouldn't work any more on export as you are expecting and you would have to make config ignore not ignore the config ignore config on exporting (ie not use the simple mode). Which would mean that you can configure it to behave the way you want, but at the expense of being a bit more difficult to understand the nuanced configuration.

    Just for clarification: You do ignore the config ignore config right? otherwise the first deployment would set it back and the next one would create the same problem for you.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada julienr Montrรฉal, QC

    Thanks for the fast response.

    You do ignore the config ignore config right?

    Yes, it is in the ignored configurations.

    Exporting ignored configurations is not a concern in the use case I'm facing: The only issue I faced was when importing config, and a new configuration to ignore was added directly on a website, which had not been done in quite a while.

    Also, I had overlooked ๐Ÿ› Use ignore settings from storage being transformed if they exist Fixed as unrelated to the situation, so thanks again for bringing it to attention.

    If I understand you correctly, changing the storage used when determining which config to ignore would fix the behavior to what I was expecting?
    Is this something that would be possible to change on a per-site basis, at the settings level?

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland bircher ๐Ÿ‡จ๐Ÿ‡ฟ

    No this wouldn't need to be configured at a environment specific settings level.
    If you ignore the config ignore config it should just take the one that it is going to then ignore anyway. so if you set your site to do so then you effectively say "I am managing the config ignore settings per site and not through configuration management".

  • First commit to issue fork.
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Updated the code to look for destination config ignore settings and if that config is there in destination then will ignore the configs added in destination. Please review. If there are some suggestion please let me know.

  • Pipeline finished with Failed
    8 months ago
    Total: 202s
    #130616
  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland bircher ๐Ÿ‡จ๐Ÿ‡ฟ

    Thanks for the MR!
    However the approach in the code is wrong. We already have a way to know if some piece of config is ignored or not, so we should re-use that.

    You touched even the code that creates the ConfigIgnoreConfig object by reading from a config storage, we need to create another one and ask it if the config ignore settings are ignored for updating and if so we use that object instead of the ones currently created.

    And this is quite a big change, so we definitely also need a test for it.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Hi @bircher, I'm bit confused should we change the implementation or should we add test here?

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland bircher ๐Ÿ‡จ๐Ÿ‡ฟ

    it needs a test and it also the code/implementation needs to be completely changed.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain aheredia

    Hi I have a similar problem because current module version has different behaviour on import than the previous one.

    On 8.2.x

    My admin interface ignored:
    webform.webform.*
    and is aligned with the confing_ignore.settings.yml.

    Imagine I want to make a deployment where I change an specific weborm.
    I would go to admin interface I would add the exception there without doing any kind of drush cex only admin interface.

    So looks like
    Admin interface:
    webform.webform.*
    ~webform.webform.contact_us
    But confing_ignore.settings.yml. still has
    webform.webform.*
    Then, on the deployment there is is a drush cim command that
    detect 2 changes and updates them
    webform.webform.contact_us
    config_ignore.settings.yml

    So after the deployment I have webform.webform.contact_us changes applied and the admin interface reverted to only
    webform.webform.* and aligned again with config_ignore.settings.yml

    With version 8.3.x seems that is not possible any more because it looks to transformation_storage

    Maybe its only a question to point always to ConfigIgnoreConfig::fromConfig($this->configFactory->get('config_ignore.settings'));

    Son changing:

    if ($transformation_storage->exists('config_ignore.settings')) {
          try {
            // This can be used to hook into config ignore via an event subscriber
            // which alters the data prior to the config ignore subscriber.
            $settings = $transformation_storage->read('config_ignore.settings');
            $ignoreConfig = new ConfigIgnoreConfig($settings['mode'] ?? 'simple', $settings['ignored_config_entities'] ?? []);
          }
          catch (\InvalidArgumentException $exception) {
            // We should probably log this exception.
          }
        }
        if (!isset($ignoreConfig)) {
          $ignoreConfig = ConfigIgnoreConfig::fromConfig($this->configFactory->get('config_ignore.settings'));
        }
    

    By
    $ignoreConfig = ConfigIgnoreConfig::fromConfig($this->configFactory->get('config_ignore.settings'));

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sanket.addweb

    @aheredia, I have encountered the same problem with 'config_ignore.settings' being present in the ignore list. The issue arises when we add 'config_ignore.settings' to the list of ignored configurations and it should not revert during drush cim.

    Therefore, I have included 'config_ignore.settings' in the config ignore array. Now, both drush cim and drush cex are functioning properly, and if 'config_ignore.settings' is present in the ignore list, it does not revert back.

  • Status changed to Needs review 7 months ago
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland bircher ๐Ÿ‡จ๐Ÿ‡ฟ

    The patch from #13 does not do what I asked in #9 and it doesn't have tests.
    Without tests, the issue will have to remain "needs work".

    Also please if you are considering contributing to this issue, do not manipulate the ignored settings without a ConfigIgnoreConfig because doing so will inevitably be wrong.

Production build 0.71.5 2024