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

GiteaHttpStatusException: HTTP 404/Not Found by querying branches with slashes

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • gitea-plugin
    • None
    • Gitea Plugin 1.3.0
      Jenkins ver. 2.303.2
      Gitea 1.15.6

      After update of the Gitea Plugin form 1.2.1 to 1.3.0 following error occurs:

      21:33:41  Started by upstream project "bla/ble/blu" build number 87
      21:33:41  originally caused by:
      21:33:41   Started by timer with parameters: {...}
      21:33:41  Querying the current revision of branch 6.6.5/release...
      21:33:41  org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 404/Not Found
      21:33:41  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getObject(DefaultGiteaConnection.java:866)
      21:33:41  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranch(DefaultGiteaConnection.java:267)
      21:33:41  	at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:187)
      21:33:41  	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
      21:33:41  	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100)
      21:33:41  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310)
      21:33:41  	at hudson.model.ResourceController.execute(ResourceController.java:99)
      21:33:41  	at hudson.model.Executor.run(Executor.java:431)
      21:33:41  Finished: FAILURE

      Querying the current revision of branch without slashes in the name (e.g. master) causes no errors.

      Workaround: downgrade to Gitea Plugin version 1.2.1

       

          [JENKINS-67068] GiteaHttpStatusException: HTTP 404/Not Found by querying branches with slashes

          m l created issue -
          m l made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          m l made changes -
          Environment Original: Gitea Plugin 1.2.1
          Jenkins ver. 2.249.1
          Gitea 1.13.0
          New: Gitea Plugin 1.3.0
          Jenkins ver. 2.303.2
          Gitea 1.15.6
          m l made changes -
          Description Original: 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?
          New: After update of the Gitea Plugin form 1.2.1 to 1.3.0 following error occurs:
          {noformat}
          21:33:41 Started by upstream project "bla/ble/blu" build number 87
          21:33:41 originally caused by:
          21:33:41 Started by timer with parameters: {...}
          21:33:41 Querying the current revision of branch 6.6.5/release...
          21:33:41 org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 404/Not Found
          21:33:41 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getObject(DefaultGiteaConnection.java:866)
          21:33:41 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranch(DefaultGiteaConnection.java:267)
          21:33:41 at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:187)
          21:33:41 at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
          21:33:41 at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100)
          21:33:41 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310)
          21:33:41 at hudson.model.ResourceController.execute(ResourceController.java:99)
          21:33:41 at hudson.model.Executor.run(Executor.java:431)
          21:33:41 Finished: FAILURE{noformat}
          Querying the current revision of branch without slashes in the name (e.g. master) causes no errors.

          Workaround: downgrade to Gitea Plugin version 1.2.1

           

          Steven added a comment - - edited

          Hi mrlov. Unfortunately, I cannot reproduce this error. Can you tell me what Gitea received as request in that situation? I mean the request URL if possible. I'd like to see how the branch name get passed from the plugin to Gitea.

          Also: Since I'm not able to reproduce it, I need your help to identify the issue. Could you check if the issue occurs using this incremental build: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.2.2-rc167.baf58a01f615/. It is the build after the PR https://github.com/jenkinsci/gitea-plugin/pull/29 got merged.

          If so, please verify, that the previous build works for you, which would be this build artifact: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.2.2-rc166.b3940c00cc4a/.

          By any chance, does this only occur if it is triggered from an upstream build?

           

          Steven added a comment - - edited Hi mrlov . Unfortunately, I cannot reproduce this error. Can you tell me what Gitea received as request in that situation? I mean the request URL if possible. I'd like to see how the branch name get passed from the plugin to Gitea. Also: Since I'm not able to reproduce it, I need your help to identify the issue. Could you check if the issue occurs using this incremental build:  https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.2.2-rc167.baf58a01f615/ . It is the build after the PR https://github.com/jenkinsci/gitea-plugin/pull/29  got merged. If so, please verify, that the previous build works for you, which would be this build artifact: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.2.2-rc166.b3940c00cc4a/ . By any chance, does this only occur if it is triggered from an upstream build?  

          Hi Steven, 

          we are running into the same issue. 

          Unfortunately i can't tell you the URL that was received by Gitea. But we are able to reproduce the error with 1.2.2-rc167.baf58a01f615. The previous Build worked for us (1.2.2-rc166.b3940c00cc4a).

          The error occurs when the build was triggered manually.

          Lennart Schwahn added a comment - Hi Steven,  we are running into the same issue.  Unfortunately i can't tell you the URL that was received by Gitea. But we are able to reproduce the error with 1.2.2-rc167.baf58a01f615. The previous Build worked for us (1.2.2-rc166.b3940c00cc4a). The error occurs when the build was triggered manually.

          Steven added a comment -

          Thanks for your feedback lschwahn. It seems that it actually is a regression for some users. Don't know yet, why this is no generic issue.

          Have you configured a Gitea organisation where you trigger a build for a specific repository branch or is this a freestyle job with Gitea as SCM source?

          Could you share a list of your used plugins and versions on your environment? I'm especially interested in branch-api, git and scm-api but a full list would be great so that I can check if there are mismatches with my used testing environment.

          Also, I've re-implemented some code that was removed in mentioned PR 29. It would be awesome if you could test this with the incremental build from PR (https://github.com/jenkinsci/gitea-plugin/pull/44).

          https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.4.1-rc185.835ca3088725/

          Steven added a comment - Thanks for your feedback lschwahn . It seems that it actually is a regression for some users. Don't know yet, why this is no generic issue. Have you configured a Gitea organisation where you trigger a build for a specific repository branch or is this a freestyle job with Gitea as SCM source? Could you share a list of your used plugins and versions on your environment? I'm especially interested in branch-api, git and scm-api but a full list would be great so that I can check if there are mismatches with my used testing environment. Also, I've re-implemented some code that was removed in mentioned PR 29. It would be awesome if you could test this with the incremental build from PR ( https://github.com/jenkinsci/gitea-plugin/pull/44 ). https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitea/1.4.1-rc185.835ca3088725/

          Marcelo Castro added a comment - - edited

          Hello Steven,

          thank you for the new Image. The new image works. We are using a Gitea organisation.

          We are running the jenkins on our kubernetes-cluster 1.20.11

          Docker: 20.10.10

          Helm-chart: https://charts.jenkins.io (3.8.8) 

          Plugin-list:

          1. tag: 2.321-jdk11
          2. installPlugins:
          3. - antisamy-markup-formatter:2.1
          4. - blueocean:1.24.7
          5. - build-monitor-plugin:1.12+build.201809061734
          6. - command-launcher:1.6
          7. - configuration-as-code:1.54
          8. - credentials-binding:1.27
          9. - credentials:2.6.2
          10. - docker-workflow:1.26
          11. - email-ext:2.83
          12. - embeddable-build-status:2.0.3
          13. - git:4.10.0
          14. - gitea:1.2.1
          15. - git-server:1.10
          16. - greenballs:1.15.1
          17. - htmlpublisher:1.25
          18. - jdk-tool:1.5
          19. - job-dsl:1.77
          20. - kubernetes-credentials-provider:0.20
          21. - kubernetes:1.30.10
          22. - ldap:2.7
          23. - matrix-auth:2.6.7
          24. - pipeline-utility-steps:2.8.0
          25. - rebuild:1.32
          26. - simple-theme-plugin:0.6
          27. - sshd:3.1.0
          28. - timestamper:1.13
          29. - workflow-aggregator:2.6
          30. - workflow-job:2.41
          31. - jira:3.6 

          Marcelo Castro added a comment - - edited Hello Steven, thank you for the new Image. The new image works. We are using a Gitea organisation. We are running the jenkins on our kubernetes-cluster 1.20.11 Docker: 20.10.10 Helm-chart:  https://charts.jenkins.io  (3.8.8)  Plugin-list: tag: 2.321-jdk11 installPlugins: - antisamy-markup-formatter:2.1 - blueocean:1.24.7 - build-monitor-plugin:1.12+build.201809061734 - command-launcher:1.6 - configuration-as-code:1.54 - credentials-binding:1.27 - credentials:2.6.2 - docker-workflow:1.26 - email-ext:2.83 - embeddable-build-status:2.0.3 - git:4.10.0 - gitea:1.2.1 - git-server:1.10 - greenballs:1.15.1 - htmlpublisher:1.25 - jdk-tool:1.5 - job-dsl:1.77 - kubernetes-credentials-provider:0.20 - kubernetes:1.30.10 - ldap:2.7 - matrix-auth:2.6.7 - pipeline-utility-steps:2.8.0 - rebuild:1.32 - simple-theme-plugin:0.6 - sshd:3.1.0 - timestamper:1.13 - workflow-aggregator:2.6 - workflow-job:2.41 - jira:3.6 
          Steven made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Steven made changes -

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

              Created:
              Updated:
              Resolved: