Skip to content

Skip create push rule when creating project

What does this MR do and why?

Relates to: #363821
Reslove: Already existing projects don't inherit global push rule or group push rule .

Stop persisting project push rules if they are inherited from a group or from PushRule.global, use predefined_push_rules instead

inspired by this conversation cc @bwill

Screenshots or screen recordings

current create project push rule flow

graph TD
    G[Create project] --> A[has group]
    A -->|false| B(create rule from global)
    A -->|true| C(Search predefined rule in group)
    C -->|rule exist| D(create rule from group)
    C -->|can not find any rules| B
    B --> *
    D --> *

we can full fill it in push rule checker , like this

graph TD
    G[check push rule] --> A[has rule]
    A -->|false| B(has group)
    A -->|true| E[project push rule]
    B -->|true| D[has push rule in ancestors ]
    D -->|true| C[group push rule]
    D -->|false| F
    B -->|false| F[global push rule]
    E --> *
    F --> *
    C --> *

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Yongbo li

Merge request reports