You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The precedence order for settings file is repository > suborg > org (.github/repos/.yml > .github/suborgs/.yml > .github/settings.yml)
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.
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.
In the repository-level settings file, I made the below modifications to the rules, but few of them were not applied as expected:
removed deletion rule - This rule was brought back due to the merge
added creation rule Works as expected
changed required_approving_review_count from 0 to 1 - Works as expected
changed dismiss_stale_reviews_on_push from false to true - Works as expected
removed actor_id: 1 and actor_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 is resulting in error
If the ruleset exists, the app successfully sends a PUT request with the merged config as the request body(full logs). However, when the ruleset doesn't exist, the app makes a POST request with the same merged config, which leads to the below error(full logs).
- 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.
Rules removed from the repository-level settings file should not be included in the ruleset.
Actor IDs removed from the repository-level settings file should not appear in the bypass actors.
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.
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.
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 is 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: