Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64351

Avoid to trigger/webhook Gitea PRs which have changes conflicting with the target branch

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • gitea-plugin
    • None
    • Gitea Plugin 1.2.1
      Jenkins ver. 2.249.1
      Gitea 1.13.0

      There are PRs which state in Gitea: "This pull request has changes conflicting with the target branch."

      As for all PRs also for these PRs the Gitea webhooks Jenkins and the build fails as expected. See attached log for the thrown exception.

      Additionally there is no possibility to catch the exception, since it is thrown within the default checkout stage and so there is no possibility to handle it better, e.g. by means of  build failure analyzer or a meaningful notification.

       

      Expected Results: Gitea does not trigger/webhook pull requests which have changes conflicting with the target branch. Or the Jenkins Gitea Plugin do recognize such webhooks and does not start a build. Both alternatives could be configurable.

       

      Maybe the API flag "mergeable" should be considered?

          [JENKINS-64351] Avoid to trigger/webhook Gitea PRs which have changes conflicting with the target branch

          Steven added a comment -

          Hi. There are three different strategies for building a pull request. The second one wouldn't result in a build error even if Gitea itself noticed a merge conflict. So a generic "do-not-build" would not be wise, IMHO.

          Would it be helpful to have a different status posted from Jenkins to Gitea for such PRs? A more descriptive one?

          Do you have issues caused by such failing builds?

          Steven added a comment - Hi. There are three different strategies for building a pull request. The second one wouldn't result in a build error even if Gitea itself noticed a merge conflict. So a generic "do-not-build" would not be wise, IMHO. Would it be helpful to have a different status posted from Jenkins to Gitea for such PRs? A more descriptive one? Do you have issues caused by such failing builds?

          m l added a comment -

          I think the best solution would be to add forth strategy:

          Merging the pull request with the current target branch revision, except for merge conflicts

          A different status posted form Jenkins to Gitea or a more descriptive one, could be also an option. But this does not help directly with the issue to make the problem clear for a Jenkins user:
          The issue with such failing builds is that the information for the cause of the failing (= merge conflict) is hidden in the log/console output and not clearly visible. And as I already wrote in the description, there is no possibility to catch the exception and clearly inform a user.

          m l added a comment - I think the best solution would be to add forth strategy: Merging the pull request with the current target branch revision, except for merge conflicts A different status posted form Jenkins to Gitea or a more descriptive one, could be also an option. But this does not help directly with the issue to make the problem clear for a Jenkins user: The issue with such failing builds is that the information for the cause of the failing (= merge conflict) is hidden in the log/console output and not clearly visible. And as I already wrote in the description, there is no possibility to catch the exception and clearly inform a user.

            Unassigned Unassigned
            mrlov m l
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: