Skip to content
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

Create / update consistent bpr for all repos #6

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

netomi
Copy link
Contributor

@netomi netomi commented Sep 19, 2023

This fixes also #4 .

For the cdt repo, I changed the pattern from * to the main branch only but the cdt_* branches could also be included?

@netomi netomi requested review from a team as code owners September 19, 2023 19:37
@github-actions

This comment has been minimized.

@github-actions
Copy link

Diff for 26f5c76:
Printing local diff for configuration at '/home/runner/work/.eclipsefdn/.eclipsefdn/otterdog-configs/otterdog.json'

Actions are indicated with the following symbols:
+   create
!   modify
!   forced update
-   delete

Organization eclipse-cdt[id=eclipse-cdt]
  there have been 2 validation infos, enable verbose output with '-v' to to display them.

+   add branch_protection_rule[pattern="main", repository=".github"] {
+     allows_deletions                                         = false
+     allows_force_pushes                                      = false
+     blocks_creations                                         = false
+     bypass_force_push_allowances                             = []
+     bypass_pull_request_allowances                           = []
+     dismisses_stale_reviews                                  = false
+     is_admin_enforced                                        = false
+     lock_allows_fetch_and_merge                              = false
+     lock_branch                                              = false
+     pattern                                                  = "main"
+     push_restrictions                                        = []
+     require_last_push_approval                               = false
+     required_approving_review_count                          = "0"
+     required_status_checks                                   = [
+       "eclipse-eca-validation:eclipsefdn/eca"
+     ],
+     requires_code_owner_reviews                              = false
+     requires_commit_signatures                               = false
+     requires_conversation_resolution                         = false
+     requires_deployments                                     = false
+     requires_linear_history                                  = false
+     requires_pull_request                                    = true
+     requires_status_checks                                   = true
+     requires_strict_status_checks                            = false
+     restricts_pushes                                         = false
+     restricts_review_dismissals                              = false
+   }

-   remove branch_protection_rule[pattern="*", repository="cdt"] {
-     allows_deletions                                         = false
-     allows_force_pushes                                      = false
-     blocks_creations                                         = false
-     bypass_force_push_allowances                             = []
-     bypass_pull_request_allowances                           = [
-       "@jonahgraham"
-     ],
-     dismisses_stale_reviews                                  = false
-     is_admin_enforced                                        = false
-     lock_allows_fetch_and_merge                              = false
-     lock_branch                                              = false
-     pattern                                                  = "*"
-     push_restrictions                                        = []
-     require_last_push_approval                               = false
-     required_approving_review_count                          = "0"
-     requires_code_owner_reviews                              = false
-     requires_commit_signatures                               = false
-     requires_conversation_resolution                         = false
-     requires_deployments                                     = false
-     requires_linear_history                                  = false
-     requires_pull_request                                    = true
-     requires_status_checks                                   = false
-     restricts_pushes                                         = false
-     restricts_review_dismissals                              = false
-   }

+   add branch_protection_rule[pattern="main", repository="cdt"] {
+     allows_deletions                                         = false
+     allows_force_pushes                                      = false
+     blocks_creations                                         = false
+     bypass_force_push_allowances                             = []
+     bypass_pull_request_allowances                           = []
+     dismisses_stale_reviews                                  = false
+     is_admin_enforced                                        = false
+     lock_allows_fetch_and_merge                              = false
+     lock_branch                                              = false
+     pattern                                                  = "main"
+     push_restrictions                                        = []
+     require_last_push_approval                               = false
+     required_approving_review_count                          = "0"
+     required_status_checks                                   = [
+       "eclipse-eca-validation:eclipsefdn/eca"
+     ],
+     requires_code_owner_reviews                              = false
+     requires_commit_signatures                               = false
+     requires_conversation_resolution                         = false
+     requires_deployments                                     = false
+     requires_linear_history                                  = false
+     requires_pull_request                                    = true
+     requires_status_checks                                   = true
+     requires_strict_status_checks                            = false
+     restricts_pushes                                         = false
+     restricts_review_dismissals                              = false
+   }

+   add branch_protection_rule[pattern="cdt_*", repository="cdt"] {
+     allows_deletions                                         = false
+     allows_force_pushes                                      = false
+     blocks_creations                                         = false
+     bypass_force_push_allowances                             = []
+     bypass_pull_request_allowances                           = []
+     dismisses_stale_reviews                                  = false
+     is_admin_enforced                                        = false
+     lock_allows_fetch_and_merge                              = false
+     lock_branch                                              = false
+     pattern                                                  = "cdt_*"
+     push_restrictions                                        = []
+     require_last_push_approval                               = false
+     required_approving_review_count                          = "0"
+     required_status_checks                                   = [
+       "eclipse-eca-validation:eclipsefdn/eca"
+     ],
+     requires_code_owner_reviews                              = false
+     requires_commit_signatures                               = false
+     requires_conversation_resolution                         = false
+     requires_deployments                                     = false
+     requires_linear_history                                  = false
+     requires_pull_request                                    = true
+     requires_status_checks                                   = true
+     requires_strict_status_checks                            = false
+     restricts_pushes                                         = false
+     restricts_review_dismissals                              = false
+   }

+   add branch_protection_rule[pattern="master", repository="cdt-lsp"] {
+     allows_deletions                                         = false
+     allows_force_pushes                                      = false
+     blocks_creations                                         = false
+     bypass_force_push_allowances                             = []
+     bypass_pull_request_allowances                           = []
+     dismisses_stale_reviews                                  = false
+     is_admin_enforced                                        = false
+     lock_allows_fetch_and_merge                              = false
+     lock_branch                                              = false
+     pattern                                                  = "master"
+     push_restrictions                                        = []
+     require_last_push_approval                               = false
+     required_approving_review_count                          = "0"
+     required_status_checks                                   = [
+       "eclipse-eca-validation:eclipsefdn/eca"
+     ],
+     requires_code_owner_reviews                              = false
+     requires_commit_signatures                               = false
+     requires_conversation_resolution                         = false
+     requires_deployments                                     = false
+     requires_linear_history                                  = false
+     requires_pull_request                                    = true
+     requires_status_checks                                   = true
+     requires_strict_status_checks                            = false
+     restricts_pushes                                         = false
+     restricts_review_dismissals                              = false
+   }
  
  Plan: 4 to add, 0 to change, 1 to delete.
Showing diff to a canonical version of the configuration at '/home/runner/work/.eclipsefdn/.eclipsefdn/otterdog-configs/otterdog.json'

Organization eclipse-cdt[id=eclipse-cdt]
--- original
+++ canonical
@@ -1,13 +1,16 @@
 local orgs = import 'vendor/otterdog-defaults/otterdog-defaults.libsonnet';
 
+local custom_branch_protection_rule(pattern) = 
+  orgs.newBranchProtectionRule(pattern) {
+
+    required_approving_review_count: 0
+  };
 orgs.newOrg('eclipse-cdt') {
   _repositories+:: [
     orgs.newRepo('.github') {
       allow_update_branch: false
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('main') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('main')
       ]
       dependabot_alerts_enabled: false
       description: "Eclipse CDT™ C/C++ Development Tools"
@@ -21,12 +24,8 @@
       allow_merge_commit: false
       allow_update_branch: false
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('cdt_*') {
-          required_approving_review_count: 0
-        }
-        orgs.newBranchProtectionRule('main') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('cdt_*')
+        custom_branch_protection_rule('main')
       ]
       dependabot_security_updates_enabled: true
       description: "Eclipse CDT™ C/C++ Development Tools"
@@ -38,9 +37,7 @@
     orgs.newRepo('cdt-infra') {
       allow_update_branch: false
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('master') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('master')
       ]
       default_branch: "master"
       dependabot_security_updates_enabled: true
@@ -51,9 +48,7 @@
       allow_merge_commit: false
       allow_update_branch: false
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('master') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('master')
       ]
       default_branch: "master"
       description: "Eclipse CDT™ LSP Extensions for CDT"
@@ -63,9 +58,7 @@
     orgs.newRepo('cdt-new-managedbuild-prototype') {
       archived: true
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('master') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('master')
       ]
       default_branch: "master"
       description: "Prototype of new Managed Build system for Eclipse CDT"
@@ -74,9 +67,7 @@
     orgs.newRepo('cdt-vscode') {
       archived: true
       branch_protection_rules: [
-        orgs.newBranchProtectionRule('master') {
-          required_approving_review_count: 0
-        }
+        custom_branch_protection_rule('master')
       ]
       default_branch: "master"
       description: "C/C++ Development Tooling (CDT) Visual Studio Code extension"

@jonahgraham
Copy link
Member

For eclipse-cdt org repos you can make it for all branches as the flow recommends not to push private branches to the repo.

@netomi netomi merged commit d844c52 into main Sep 19, 2023
2 checks passed
@netomi netomi deleted the create-bpr-for-all-repos branch September 19, 2023 21:14
@netomi netomi restored the create-bpr-for-all-repos branch September 19, 2023 21:15
@netomi netomi deleted the create-bpr-for-all-repos branch September 19, 2023 21:16
netomi added a commit that referenced this pull request Sep 19, 2023
@netomi
Copy link
Contributor Author

netomi commented Sep 19, 2023

so the pattern should be changed to * for all repos?

@jonahgraham
Copy link
Member

Yes please.

@netomi
Copy link
Contributor Author

netomi commented Sep 19, 2023

pushed commit to apply bpr to all branches in 91611eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants