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

Issue with latest subversion plugin (1.13). Maybe with 1.14 also

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • subversion-plugin
    • None
    • windows xp sp2, sun JAVA 1.6.0_16, apache tomcat 5.5

      Problem: If you setup a project of type: "Build a free-style software project" with subversion set AND POLL SCM checked with 1 minute testing interval (CRON/INTERVAL OF: "* * * * *"), everything will work fine as long as subversion server is available. However, if the subversion server is not available because the svn server is simply not running or the network access is not there, then the first minute SCM POLLING log under the project, you will see the SVNException caused by java.net.ConnectException and the outcome of "No changes". Then, when the second minute SCM POLLING happens, the outcome will be "Changes found". Thus, a build will be queued and the build will fail because the svn server is not accessible/available.

      Expected Behavior: I was expecting subversion plugin to simply detect that the svn server is not available and just conclude that subversion plugin cannot determine if a build is needed.

      HERE IS THE FIX I CREATED:

      Within SubversionSCM.java:

                  public PollingResult call() throws IOException {
                      final Map<String,Long> revs = new HashMap<String,Long>();
                      boolean changes = false;
                      boolean significantChanges = false;
      
                      for (Map.Entry<String,Long> baselineInfo : baseline.revisions.entrySet()) {
                          String url = baselineInfo.getKey();
                          long baseRev = baselineInfo.getValue();
      
                          try {
                              final SVNURL svnurl = SVNURL.parseURIDecoded(url);
                              long nowRev = new SvnInfo(parseSvnInfo(svnurl,authProvider)).revision;
      
                              changes |= (nowRev>baseRev);
      
                              listener.getLogger().println(Messages.SubversionSCM_pollChanges_remoteRevisionAt(url, nowRev));
                              revs.put(url, nowRev);
                              // make sure there's a change and it isn't excluded
                              if (logHandler.findNonExcludedChanges(svnurl,
                                      baseRev+1, nowRev, authProvider)) {
                                  listener.getLogger().println(Messages.SubversionSCM_pollChanges_changedFrom(baseRev));
                                  significantChanges = true;
                              }
                          } catch (SVNException e) {
      						// DEFECT FIX:  This is a fix to address the issue of when the svn repository is unavailable.
      						//              The bug happens due to the SubversionSCM logic thinking a build is needed when
      						//              really we do not have any information from remote SVN repository to determine this.
      						// Author:  Jeffrey Lutz bulkmail@lutz.ws
                              // If SVNException was caused by connection failure to subversion, then make sure to make
                              // "current" SVNRevisionState is like "baseline" SVNRevisionState with regards to revisions
                              //
                              if(e.getCause() instanceof java.net.ConnectException) {
                                  revs.put(url, baseRev);
                              }
                              e.printStackTrace(listener.error(Messages.SubversionSCM_pollChanges_exception(url)));
                          }
                      }
      
                      assert revs.size()== baseline.revisions.size();
      
                      Change currentChange = significantChanges ? Change.SIGNIFICANT : changes ? Change.INSIGNIFICANT : Change.NONE;
      
                      return new PollingResult(baseline, new SVNRevisionState(revs), currentChange);
                  }
      

            Unassigned Unassigned
            jeffreylutz jeffreylutz
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: