Apply JIRA Policy Against doesn't seem to work

Issue #4 new
Marcus Revington created an issue

I'm not sure if this is just not working as I expect it to or I have it configured incorrectly but I would expect that if I don't have a checkbox ticked say against Hotfix. If I create a pull request between hotfix/foo into master then the rules wouldn't apply.

But I am getting a must contain a JIRA issue notice, which I don't have because it's a hotfix. I would have expected this to allow me to merge in the pull request.

Comments (5)

  1. Julius Davies [bit-booster.com] repo owner

    Merges from UNPROTECTED into PROTECTED trigger the check.

    In this case "hotfix" is UNPROTECTED (doesn't have a checkbox) whereas "master" is PROTECTED (has a checkbox), and so the check is triggered.

    FYI:

    Merges from UNPROTECTED to UNPROTECTED obviously NEVER trigger the check. :-)

    Merges from PROTECTED into PROTECTED also do NOT trigger the check, even if the commit being merged does not currently satisfy the checks. This helps give admins some flexibility to grandfather things, or to push things in via the exemption lists. Also important for merge-backs from old production branches where the JIRA ticket's status might now be DONE or CLOSED.

    p.s. I recommend also checking "Default". This is typically "master" --- it's whatever the "Default branch" is set to in repo --> settings --> details. Probably your "master" branch is already protected via the "Production" or "Development" checkboxes, but redundancy doesn't hurt.

  2. Marcus Revington reporter

    I don't mean to use up too much of your time but you have been very helpful. Maybe then you could suggest a configuration which could work for our workflows and potentially provide an example in your documentation.

    • We always enforce having personal forks
    • Developers push their branches up to their repo and then create pull requests between their personal repo and the master repo
    • I am happy to protect their personal repos but would prefer to allow them the flexiblity to not
    • What I really want to protect is pull requests from the personal repo into the master
    • I don;t want to have JIRA issue check triggered on for example hotfix/test, where the deployment is time critical and we just want it merged in, screw the jira issue

    I have done a test where I have made a commit into my personal repo without a JIRA issue, personal repo is NOT protected, it pushes up fine. I then pull request into the master repo, commit name is feature/test, as per your above it should trigger the check, but it does not and allows me to merge the pull request. So what is wrong here?

  3. Julius Davies [bit-booster.com] repo owner

    Try this (from the control freak global settings):

    At the very top:

    Enabled For: regulars only. (Don't check the "personal" ones).

    And then for the JIRA check:

    Apply JIRA Policy Against: [check everything except hotfix branches]

    That should achieve what you described. Make sure project and repo overrides are not perturbing these for the repo you're testing with, since project/repo overrides obviously completely override any global settings!

    But you will have some headaches when you try to merge hotfix work back into master (which is an important thing to do!). For those cases I would temporarily add the person merging into the "Exemptions" list to get their hotfix merged into master without the check. The alternative is to "amend" the hotfix tip commit, but that's not ideal, since it changes the commit-id.

    For the exact usecase I'm thinking of adding a "20 minute" exemption button where a repo admin can go in and click a button to turn off all checks for themselves for 20 minutes. (Helps avoid the situation above where they add themselves to the exemption list but later forget to remove themselves). But we're pretty busy these days and this is a bit of a low priority. Probably wouldn't be implemented for 6-8 weeks. What do you think of the idea?

    Oh, one last thing about your usecase: if "all other branches" is unchecked, AND your branching model (repo --> settings) has set "Feature" to a different pattern than "feature/", then the merge check would be skipped. Checking "all other branches" prevents this problem. Alternatively, make sure branching model has not been altered from the defaults.

  4. Julius Davies [bit-booster.com] repo owner

    p.s. Sorry that was a pretty condensed answer. I can provide some screenshots if that would help you. Let me know!

  5. Log in to comment