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

Gitea not notified correctly in case PR is merged via rebase/ff and branch gets deleted during PR build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • gitea-plugin
    • Jenkins 2.319.3
      Gitea 1.17.1
      Gitea Plugin 1.4.1

      If a user decides to merge a pull request via rebasing/fast-forward and checks the "Delete branch" checkbox while the Jenkins build of the most recent commit in the pull request is still running, the build fails but Gitea is not notified.

      Longer explanation:

      When having a pull request open, Gitea  can be configured to offer merging the branch via rebase and fast-forwarding, so no explicit branch commit is created.  At the same time, Gitea offers a check box to delete a branch after closing the pull request.

      If I merge a PR via rebase/fast-forward and choose to delete the branch after merging, and I do all of that while the build of the pull request is still in progress, the Jenkins build of the pull request will fail, but Gitea is apparently not notified about the failure as the icon of the PR will stay the "yellow circle" (build in progress).

      See the attached screenshots for an example:

      1. PR.png shows the PR, which was closed while the build of the most recent commit was still in progress.
      2. failed_build.png shows the Blue Ocean view of this build.
      3. pipeline_tail_fail.txt shows the end of the pipeline.log of the failed build.  The checkout step seems to fail without Jenkins noticing.  Only the subsequent usage of a file in the repo (which is missing, because checkout failed) then causes an error.
      4. targetbranch.png shows the target branch (master in this case) when clicking on the build status icon ("yellow circle").
      5. successful_build.png shows the Blue Ocean view of the build triggered by the new commit on master (which has the same hash due to rebase/fast-forward).
      6. pipeline_tail_successful.txt shows the end of the pipeline.log of the successful build.
      7. For completeness, I added the Jenkinsfile I used.  The "cat readme.md" is just to use some file in the repo and trigger an error if the checkout failed.

       

      Obviously, deleting the branch while a build is in progress is not nice.  However, the subsequent build failure should be told to Gitea and you shouldn't end up with an eternal "build in progress" icon.  I see two problems here:

      1. The "checkout" pipeline step fails without Jenkins noticing (it's displayed in green in Blue Ocean).  Compare also the two pipeline logs from failed and successful build.
      2. The build fails (it's red in blue ocean) but Gitea is not notified.  As can be seen in pipeline_tail_fail.txt, the part with "[Gitea] Notifying branch build status" is missing.

        1. failed_build.png
          failed_build.png
          71 kB
        2. Jenkinsfile
          0.5 kB
        3. pipeline_tail_fail.txt
          0.5 kB
        4. pipeline_tail_successful.txt
          1 kB
        5. PR.png
          PR.png
          131 kB
        6. successful_build.png
          successful_build.png
          56 kB
        7. targetbranch.png
          targetbranch.png
          70 kB

            Unassigned Unassigned
            manuelmohr Manuel Mohr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: