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

Gitea PR build fails if Jenkins user is not admin of the repo

    XMLWordPrintable

Details

    Description

      If the user that Jenkins uses to authenticate to Gitea is not admin of the repository, the Jenkins job fails when building pull request. It seem to fetch collaborators which requires admin priviliges but I don't understand why that is needed.

      [Gitea] Notifying pull request build status: FAILURE There was a failure building this commit
      [Gitea] Notified
      org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 403/Forbidden
      	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getList(DefaultGiteaConnection.java:1013)
      	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchCollaborators(DefaultGiteaConnection.java:353)
      	at org.jenkinsci.plugin.gitea.GiteaSCMSource.getTrustedRevision(GiteaSCMSource.java:477)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:99)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE
      

      Attachments

        Issue Links

          Activity

            lkraider Paul Eipper added a comment - - edited

            Similar problem here, but even adding user as Admin, the error persists:

            21:18:09  Querying the current revision of pull request #58...
            21:18:09  org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 403/Forbidden
            21:18:09  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getObject(DefaultGiteaConnection.java:900)
            21:18:09  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchPullRequest(DefaultGiteaConnection.java:618)
            21:18:09  	at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:178)
            21:18:09  	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
            21:18:09  	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
            21:18:09  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
            21:18:09  	at hudson.model.ResourceController.execute(ResourceController.java:97)
            21:18:09  	at hudson.model.Executor.run(Executor.java:427)
            21:18:09  Finished: FAILURE
            
            lkraider Paul Eipper added a comment - - edited Similar problem here, but even adding user as Admin, the error persists: 21:18:09 Querying the current revision of pull request #58... 21:18:09 org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 403/Forbidden 21:18:09 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getObject(DefaultGiteaConnection.java:900) 21:18:09 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchPullRequest(DefaultGiteaConnection.java:618) 21:18:09 at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:178) 21:18:09 at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582) 21:18:09 at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98) 21:18:09 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299) 21:18:09 at hudson.model.ResourceController.execute(ResourceController.java:97) 21:18:09 at hudson.model.Executor.run(Executor.java:427) 21:18:09 Finished: FAILURE

            Seeing this too

            17:00:47  Querying the current revision of branch renovate/redis-12.1.x...
            17:00:47  org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 403/Forbidden
            17:00:47  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getList(DefaultGiteaConnection.java:983)
            17:00:47  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranches(DefaultGiteaConnection.java:293)
            17:00:47  	at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranch(DefaultGiteaConnection.java:265)
            17:00:47  	at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:187)
            17:00:47  	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
            17:00:47  	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
            17:00:47  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
            17:00:47  	at hudson.model.ResourceController.execute(ResourceController.java:97)
            17:00:47  	at hudson.model.Executor.run(Executor.java:429)
            17:00:47  Finished: FAILURE
            
            viceice Michael Kriese added a comment - Seeing this too 17:00:47 Querying the current revision of branch renovate/redis-12.1.x... 17:00:47 org.jenkinsci.plugin.gitea.client.api.GiteaHttpStatusException: HTTP 403/Forbidden 17:00:47 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.getList(DefaultGiteaConnection.java:983) 17:00:47 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranches(DefaultGiteaConnection.java:293) 17:00:47 at org.jenkinsci.plugin.gitea.client.impl.DefaultGiteaConnection.fetchBranch(DefaultGiteaConnection.java:265) 17:00:47 at org.jenkinsci.plugin.gitea.GiteaSCMSource.retrieve(GiteaSCMSource.java:187) 17:00:47 at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582) 17:00:47 at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98) 17:00:47 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309) 17:00:47 at hudson.model.ResourceController.execute(ResourceController.java:97) 17:00:47 at hudson.model.Executor.run(Executor.java:429) 17:00:47 Finished: FAILURE
            mrlov m l added a comment -

            There is no problem, when the Jenkins user has the member role "owner" of the Gitea organization.

            mrlov m l added a comment - There is no problem, when the Jenkins user has the member role "owner" of the Gitea organization.

            People

              Unassigned Unassigned
              merle_noir David Svantesson
              Votes:
              8 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: