Skip to content

Conversation

@ChrisBr
Copy link
Contributor

@ChrisBr ChrisBr commented Oct 16, 2019

PrePush::ProtectedBranches supports a destructive_only setting. However, this setting is globally valid for all protected branches. It makes sense to set this setting on a per branch basis. This PR implements the following syntax for the configuration of ProtectedBranches.

PrePush:
  ProtectedBranches:
    enabled: true
    branches:
      - protected
      - protected_for_destructive_only:
         destructive_only: true

In case it is not set on a branch it will fall back to the global setting. Additionally it will use the setting of the first matching branch.

Example:

PrePush:
  ProtectedBranches:
    enabled: true
    branch_patterns:
      - releases/*
      - releases/v1:
         destructive_only: true

In this case, a push to releases/v1 would be forbidden because releases/* would match which uses the global setting for destructive_only. The solution in this case would be to flip the order of the branch definitions.

Credit for this idea goes to @davidstosik 🎉

@ChrisBr ChrisBr changed the title [PrePush::ProtectedBranches] Implement setting destructive_only setti… [PrePush::ProtectedBranches] Implement setting destructive_only per branch Oct 16, 2019
@sds
Copy link
Owner

sds commented Oct 17, 2019

Thanks @ChrisBr. Can you also update the docs for ProtectedBranches to mention this functionality?

Otherwise, looks reasonable to me. Once you transition this from a draft happy to merge. Thanks!

@ChrisBr ChrisBr force-pushed the cb/protected_branch branch from cf93abc to 23c275c Compare October 17, 2019 07:03
@ChrisBr
Copy link
Contributor Author

ChrisBr commented Oct 17, 2019

@sds updated the documentation 👍

Thanks

@ChrisBr ChrisBr marked this pull request as ready for review October 17, 2019 07:05
@sds sds merged commit 0ee7aef into sds:master Oct 17, 2019
@ChrisBr
Copy link
Contributor Author

ChrisBr commented Oct 17, 2019

That was quick, thank you very much @sds 🎉

@ChrisBr
Copy link
Contributor Author

ChrisBr commented Dec 4, 2019

Is there a plan to release a new version anytime soon?

@sds
Copy link
Owner

sds commented Dec 15, 2019

0.52.0 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants