Prevent merge of pull request if last multibranch pipeline indicated failure #4684

Closed
opened 2025-11-02 05:59:24 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @mray271 on GitHub (Jan 19, 2020).

I'm using the multibranch pipeline testing with Jenkins. This is working and I get in Gitea a green check if testing has succeeded and a red X if testing has failed. But this is a bit hidden and does not appear on the PR page. Instead we just see "This pull request can be merged automatically." on that page. It would be better if there were some warning "Most recent testing has failed" or to prevent merging of the PR altogether if testing is failing.

Originally created by @mray271 on GitHub (Jan 19, 2020). I'm using the multibranch pipeline testing with Jenkins. This is working and I get in Gitea a green check if testing has succeeded and a red X if testing has failed. But this is a bit hidden and does not appear on the PR page. Instead we just see "This pull request can be merged automatically." on that page. It would be better if there were some warning "Most recent testing has failed" or to prevent merging of the PR altogether if testing is failing.
Author
Owner

@mray271 commented on GitHub (Jan 19, 2020):

The only place I see in Gitea that testing pipeline failure shows up is by clicking through "<> Code" --> Select the branch of the particular PR. It would be most useful if this icon also showed up on pull request page for that branch.

@mray271 commented on GitHub (Jan 19, 2020): The only place I see in Gitea that testing pipeline failure shows up is by clicking through "<> Code" --> Select the branch of the particular PR. It would be most useful if this icon also showed up on pull request page for that branch.
Author
Owner

@davidsvantesson commented on GitHub (Jan 21, 2020):

Are you using the Jenkins Gitea plugin?
In Gitea you will see status checks on each commit (a small symbol being yellow, red or green) as well on the Pull request page. There is an open issue that because the Gitea plugin calls the status checks with PR numbers, and it is thefore not possible to select individual status checks (https://issues.jenkins-ci.org/browse/JENKINS-59557). You can still set up a branch protection rule with required status checks but not selecting a specific check. That will take the complete status check results into account (if any failed it will not be possible to merge).
I hope this explanation helps.

@davidsvantesson commented on GitHub (Jan 21, 2020): Are you using the Jenkins Gitea plugin? In Gitea you will see status checks on each commit (a small symbol being yellow, red or green) as well on the Pull request page. There is an open issue that because the Gitea plugin calls the status checks with PR numbers, and it is thefore not possible to select individual status checks (https://issues.jenkins-ci.org/browse/JENKINS-59557). You can still set up a branch protection rule with required status checks but not selecting a specific check. That will take the complete status check results into account (if any failed it will not be possible to merge). I hope this explanation helps.
Author
Owner

@mray271 commented on GitHub (Jan 21, 2020):

I do see the little "Red X" next to the commits.
image

But I see nothing on the pull request page itself. I think this is where there really needs to be some indication that tests are not passing. I am using Gitea Jenkins plugin (also have BlueOcean installed) with Jenkinsfile in my Git repos that specifies the pipeline. Any ideas?
I am currently just raising an error right in my Jenkinsfile by using error "Fail this". Is a post section required in the Jenkinsfile with Junit results in order to get the other indicators showing up? It seems weird that the red x would show up in one place but not the other.

image

@mray271 commented on GitHub (Jan 21, 2020): I do see the little "Red X" next to the commits. ![image](https://user-images.githubusercontent.com/24377848/72788185-41c27000-3be6-11ea-8c56-9a9fb2db9522.png) But I see nothing on the pull request page itself. I think this is where there really needs to be some indication that tests are not passing. I am using Gitea Jenkins plugin (also have BlueOcean installed) with Jenkinsfile in my Git repos that specifies the pipeline. Any ideas? I am currently just raising an error right in my Jenkinsfile by using ``error "Fail this"``. Is a post section required in the Jenkinsfile with Junit results in order to get the other indicators showing up? It seems weird that the red x would show up in one place but not the other. ![image](https://user-images.githubusercontent.com/24377848/72787902-acbf7700-3be5-11ea-96bf-f86f237201af.png)
Author
Owner

@mray271 commented on GitHub (Jan 21, 2020):

To be clear, I'm sort of expecting a red indicator on either the "Conversation" tab right next to the "Merge Pull Request" button and/or the message there to be different somehow from "This pull request can be merged automatically". And/Or there should be an indicator higher up near the main title (i.e. next to the "#5 ENH: Fail it" in the above figure).

@mray271 commented on GitHub (Jan 21, 2020): To be clear, I'm sort of expecting a red indicator on either the "Conversation" tab right next to the "Merge Pull Request" button and/or the message there to be different somehow from "This pull request can be merged automatically". And/Or there should be an indicator higher up near the main title (i.e. next to the "#5 ENH: Fail it" in the above figure).
Author
Owner

@davidsvantesson commented on GitHub (Jan 21, 2020):

What version of Gitea are you running?
Have you setup branch protection for the target branch?

@davidsvantesson commented on GitHub (Jan 21, 2020): What version of Gitea are you running? Have you setup branch protection for the target branch?
Author
Owner

@mray271 commented on GitHub (Jan 22, 2020):

Ah, there was the reason. Was still running 1.8.3 binary. Upgraded to 1.10.3 binary and all is well and behaves just as you said.

@mray271 commented on GitHub (Jan 22, 2020): Ah, there was the reason. Was still running 1.8.3 binary. Upgraded to 1.10.3 binary and all is well and behaves just as you said.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4684