-
Notifications
You must be signed in to change notification settings - Fork 167
Config merge not working as expected for settings files #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tagging @decyjphr to check if this is a known issue. I remember seeing a comment from you on an issue mentioning known problems with the merging logic, but I can’t seem to find the issue with that comment. |
Add ref to #655 (comment) since this also seems related. |
@riprasad seems like a bug is a valid one and the merging logic seems to be creating duplicates of bypass actors, rules, etc. will take a look at this. |
@decyjphr Do you know if this has been fixed? I'm using 2.1.14 to avoid the repo renaming issue in 2.1.16 but curious if there is already another version out there which fixes this, which I am also running into. |
I am also running into this on 2.1.17 |
I'll look into this today. |
I think we should not merge the suborg ruleset settings to the repo level ruleset settings, but create a new org level ruleset with the targeting based on the sub-org targeting. This will require some refactoring of the code. I can start looking into this. |
Problem Description
As stated in the README
This implies that if the same configuration(s) are defined at different levels, the settings defined at the repository level should take precedence. However, this is not happening as expected. I discovered that the issue stems from the way
safe-settings
creates the final merged config from the settings files. The merge process does a union of the suborg and repo level settings file, which brings back the deleted configs and also creates duplicate elements. There's also an edge case where the API call fails due to duplicate elements in the merged config.What is actually happening
I have configured a ruleset at the suborganization level that applies to multiple repositories and then modify the same ruleset for a particular repository in the repo level settings file.
suborg/base-rulesets.yml
repos/repo-name.yml
What's happening is that the configurations from the suborgs and repo level settings files are getting merged as shown below. The merge process does a union of the suborg and repo level settings file, which brings back the deleted configs and also creates duplicate elements(duplicate pull_request object, duplicate ref_name in conditions object).
In the repository-level settings file, I made the below modifications to the rules, but few of them were not applied as expected:
deletion
rule - This rule was brought back due to the mergecreation
rule Works as expectedrequired_approving_review_count
from 0 to 1 - Works as expecteddismiss_stale_reviews_on_push
from false to true - Works as expectedactor_id: 1
andactor_id: 1097369
from bypass_actors list - These actors were brought back due to merge.Apart from this, the merge is also creating DUPLICATE PROPERTIES, which might be resulting in error
- include": ["refs/heads/rhoai-*","refs/heads/rhoai-*"] is causing
What is the expected behavior
The Rulesets created for the repository should exactly match the configuration defined in the repository-level settings file.
In general - the merged config should not have duplicate elements and should not bring back deleted configurations in the repo level settings file. Safe-settings should consider the repository-level settings file as the source of truth and ensure that the precedence order is respected. Hopefully, it will also prevents API calls from failing due to duplicate elements in the request body.
Error output, if available
Full Logs - https://github.com/rhoai-rhtap/admin/actions/runs/12546352801/job/34982053584
Context
Are you using the hosted instance of probot/settings or running your own?
Running a full sync using Github Action
Version of probot/settings
2.1.14
The text was updated successfully, but these errors were encountered: