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

Improve the performance of scheduling a build

XMLWordPrintable

      The current API in scm-api allows to re-index a branch source using the method SCMSourceOwner.onSCMSourceUpdated().

      Currently we are using this method to force a reindexing when a webhook event is received:

      for (final SCMSourceOwner owner : SCMSourceOwners.all()) {
          for (SCMSource source : owner.getSCMSources()) {
              if (source instanceof GitHubSCMSource) {
                  GitHubSCMSource gitHubSCMSource = (GitHubSCMSource) source;
                  if (gitHubSCMSource.getRepoOwner().equals(changedRepository.getUserName()) &&
                          gitHubSCMSource.getRepository().equals(changedRepository.getRepositoryName())) {
                      owner.onSCMSourceUpdated(gitHubSCMSource);
                  }
              }
          }
      }
      

      We need to improve this because when Jenkins receives an event from a webhook we want to be able to determinate:

      1. if we have to re-index my GitHub Organization
      2. if we have to re-index all my branches and pull requests in a GitHub repository
      3. Or simplify if we have to schedule a build because there is a new commit in a pull requests

            recena Manuel Recena Soto
            recena Manuel Recena Soto
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: