[ 
https://issues.apache.org/jira/browse/HDDS-17520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika updated HDDS-17520:
-------------------------------
    Description: 
Was checking AI on how to prevent merge to master if there are still some CI 
running. See the excerpt below.

To prevent pull requests from being merged until the latest commit finishes 
running its checks, you should use *GitHub branch protection rules* (or 
{*}GitHub Repository Rulesets{*}) paired with {*}Required Status Checks{*}.
This creates a mandatory gate that blocks the "Merge" button until your GitHub 
Actions (or third-party CI/CD tools) finish successfully for the most recent 
commit.
----
Method 1: Using Repository Rulesets (Recommended)
Rulesets are the modern, flexible way to manage branch protections across one 
or multiple branches.
On GitHub, navigate to the main page of your repository.
Under your repository name, click {*}Settings{*}.
In the left sidebar, click *Rules* > {*}Rulesets{*}.
Click *New ruleset* > {*}New branch ruleset{*}.
Give your ruleset a name (e.g., {{{}Protect Main Branch{}}}) and set the 
*Enforcement status* to {*}Active{*}.
Under {*}Target branches{*}, select *Include default branch* (or specify target 
branches via patterns).
Scroll down to *Branch rules* and check the box for {*}Require status checks to 
pass before merging{*}.
Click *Add checks* and type the name of the specific GitHub Actions workflow or 
job you want to wait for (e.g., {{{}build{}}}, {{{}test{}}}, or {{{}lint{}}}).
Click *Create* at the bottom of the page.

Method 2: Using Classic Branch Protection Rules
If you prefer the classic repository settings layout:
Go to your repository {*}Settings{*}.
In the left sidebar, click {*}Branches{*}.
Next to "Branch protection rules", click *Add rule* (or *Edit* an existing one).
In the *Branch name pattern* field, type the branch name (e.g., {{main}} or 
{{{}master{}}}).
Check the box for {*}Require status checks to pass before merging{*}.
_(Optional but recommended)_ Check *Require branches to be up to date before 
merging* if you want to ensure they test the absolute latest code against the 
target branch.
In the search bar under {*}Status checks found in the last week{*}, search for 
and select the specific status checks/jobs that must pass.
Click *Create* or {*}Save changes{*}.
----
How this behavior works with new commits
*Automatic Blocking:* Whenever a developer pushes a new commit to an open Pull 
Request, GitHub automatically marks the status checks as "Expected" or 
"Pending."
*The Barrier:* The "Merge pull request" button will instantly turn grey and 
display a message stating that required checks haven't completed yet.
*The Green Light:* Only when the _last_ commit finishes running all specified 
checks successfully will the merge button become active.

  was:
To prevent pull requests from being merged until the latest commit finishes 
running its checks, you should use *GitHub branch protection rules* (or 
{*}GitHub Repository Rulesets{*}) paired with {*}Required Status Checks{*}.
This creates a mandatory gate that blocks the "Merge" button until your GitHub 
Actions (or third-party CI/CD tools) finish successfully for the most recent 
commit.
----
Method 1: Using Repository Rulesets (Recommended)
Rulesets are the modern, flexible way to manage branch protections across one 
or multiple branches.
On GitHub, navigate to the main page of your repository.
Under your repository name, click {*}Settings{*}.
In the left sidebar, click *Rules* > {*}Rulesets{*}.
Click *New ruleset* > {*}New branch ruleset{*}.
Give your ruleset a name (e.g., {{{}Protect Main Branch{}}}) and set the 
*Enforcement status* to {*}Active{*}.
Under {*}Target branches{*}, select *Include default branch* (or specify target 
branches via patterns).
Scroll down to *Branch rules* and check the box for {*}Require status checks to 
pass before merging{*}.
Click *Add checks* and type the name of the specific GitHub Actions workflow or 
job you want to wait for (e.g., {{{}build{}}}, {{{}test{}}}, or {{{}lint{}}}).
Click *Create* at the bottom of the page.

Method 2: Using Classic Branch Protection Rules
If you prefer the classic repository settings layout:
Go to your repository {*}Settings{*}.
In the left sidebar, click {*}Branches{*}.
Next to "Branch protection rules", click *Add rule* (or *Edit* an existing one).
In the *Branch name pattern* field, type the branch name (e.g., {{main}} or 
{{{}master{}}}).
Check the box for {*}Require status checks to pass before merging{*}.
_(Optional but recommended)_ Check *Require branches to be up to date before 
merging* if you want to ensure they test the absolute latest code against the 
target branch.
In the search bar under {*}Status checks found in the last week{*}, search for 
and select the specific status checks/jobs that must pass.
Click *Create* or {*}Save changes{*}.

----
How this behavior works with new commits
*Automatic Blocking:* Whenever a developer pushes a new commit to an open Pull 
Request, GitHub automatically marks the status checks as "Expected" or 
"Pending."
*The Barrier:* The "Merge pull request" button will instantly turn grey and 
display a message stating that required checks haven't completed yet.
*The Green Light:* Only when the _last_ commit finishes running all specified 
checks successfully will the merge button become active.


> Configured Github RuleSet to prevent merging until master CI has been 
> completed
> -------------------------------------------------------------------------------
>
>                 Key: HDDS-17520
>                 URL: https://issues.apache.org/jira/browse/HDDS-17520
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Ivan Andika
>            Priority: Major
>
> Was checking AI on how to prevent merge to master if there are still some CI 
> running. See the excerpt below.
> To prevent pull requests from being merged until the latest commit finishes 
> running its checks, you should use *GitHub branch protection rules* (or 
> {*}GitHub Repository Rulesets{*}) paired with {*}Required Status Checks{*}.
> This creates a mandatory gate that blocks the "Merge" button until your 
> GitHub Actions (or third-party CI/CD tools) finish successfully for the most 
> recent commit.
> ----
> Method 1: Using Repository Rulesets (Recommended)
> Rulesets are the modern, flexible way to manage branch protections across one 
> or multiple branches.
> On GitHub, navigate to the main page of your repository.
> Under your repository name, click {*}Settings{*}.
> In the left sidebar, click *Rules* > {*}Rulesets{*}.
> Click *New ruleset* > {*}New branch ruleset{*}.
> Give your ruleset a name (e.g., {{{}Protect Main Branch{}}}) and set the 
> *Enforcement status* to {*}Active{*}.
> Under {*}Target branches{*}, select *Include default branch* (or specify 
> target branches via patterns).
> Scroll down to *Branch rules* and check the box for {*}Require status checks 
> to pass before merging{*}.
> Click *Add checks* and type the name of the specific GitHub Actions workflow 
> or job you want to wait for (e.g., {{{}build{}}}, {{{}test{}}}, or 
> {{{}lint{}}}).
> Click *Create* at the bottom of the page.
> Method 2: Using Classic Branch Protection Rules
> If you prefer the classic repository settings layout:
> Go to your repository {*}Settings{*}.
> In the left sidebar, click {*}Branches{*}.
> Next to "Branch protection rules", click *Add rule* (or *Edit* an existing 
> one).
> In the *Branch name pattern* field, type the branch name (e.g., {{main}} or 
> {{{}master{}}}).
> Check the box for {*}Require status checks to pass before merging{*}.
> _(Optional but recommended)_ Check *Require branches to be up to date before 
> merging* if you want to ensure they test the absolute latest code against the 
> target branch.
> In the search bar under {*}Status checks found in the last week{*}, search 
> for and select the specific status checks/jobs that must pass.
> Click *Create* or {*}Save changes{*}.
> ----
> How this behavior works with new commits
> *Automatic Blocking:* Whenever a developer pushes a new commit to an open 
> Pull Request, GitHub automatically marks the status checks as "Expected" or 
> "Pending."
> *The Barrier:* The "Merge pull request" button will instantly turn grey and 
> display a message stating that required checks haven't completed yet.
> *The Green Light:* Only when the _last_ commit finishes running all specified 
> checks successfully will the merge button become active.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to