jenkinsci / ghprb-plugin

github pull requests builder plugin for Jenkins
https://plugins.jenkins.io/ghprb/
MIT License
506 stars 611 forks source link

Extremely slow builds due to delay in starting to clone/cloning #780

Open tzaeru opened 4 years ago

tzaeru commented 4 years ago

Hi,

We've been moving and upgrading our CI environment. With the current Jenkins v2.237 and newest GHPRB 1.42.1, there's a problem in builds taking extremely long due to being stuck in some step at or before cloning.

image

It hangs there for an hour or more, when before that phase took just seconds.

The Jobs DSL configuration looks, for example, like this:

  scm {
    git {
      remote {
        github("our repo", "ssh")
        credentials("some credential")
        refspec('+refs/pull/*:refs/remotes/origin/pr/*')
      }
      branch('${ghprbActualCommit}')
    }
  }

  triggers {
    githubPullRequest {
      scm("H/2 * * * *")
      onlyTriggerPhrase(false)
      useGitHubHooks(false)
      permitAll(false)
     ...
    }
  }

Builds that don't use GHPRB are not slowed down.

There's some errors in Jenkins logs, see: https://github.com/jenkinsci/ghprb-plugin/issues/779

Wonder what might be going on?

tzaeru commented 4 years ago

After the build finally continues, this error is shown, though it doesn't cancel the build:

Setting status of 8fe9bb85b29efea0182dca4144e94303df03f029 to PENDING with url <url> and message: 'Build started for merge commit.'
FileNotFoundException means that the credentials Jenkins is using is probably wrong. Or the user account does not have write access to the repo.
org.kohsuke.github.GHFileNotFoundException: <url> {"message":"Not Found","documentation_url":"<url>"}
    at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:437)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:368)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:312)
    at org.kohsuke.github.Requester.fetch(Requester.java:71)
    at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:1872)
    at org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus.createCommitStatus(GhprbSimpleStatus.java:283)
    at org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus.onBuildStart(GhprbSimpleStatus.java:195)
    at org.jenkinsci.plugins.ghprb.GhprbBuilds.onStarted(GhprbBuilds.java:144)
    at org.jenkinsci.plugins.ghprb.GhprbBuildListener.onStarted(GhprbBuildListener.java:20)
    at hudson.model.listeners.RunListener.fireStarted(RunListener.java:238)
    at hudson.model.Run.execute(Run.java:1878)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/Opetushallitus/koski/statuses/8fe9bb85b29efea0182dca4144e94303df03f029
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

Could this be the cause?