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

hudson.scm.SubversionChangeLogSet.LogEntry.getAffectedPaths() does not provide expected result for parametrized Repository URLs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • subversion-plugin
    • None
    • Observed using Jenkins version 1.651.2 and the Subversion Plugin version 1.54

      The Subversion Plugin provides the implementation hudson.scm.SubversionChangeLogSet.LogEntry to extend and implement the abstract class hudson.scm.ChangeLogSet.Entry from Jenkins Core.

      The hudson.scm.ChangeLogSet.Entry defines the abstract method getAffectedPaths(), which in Javadoc is defined as follows:
      "Returns a set of paths in the workspace that was affected by this change.
      Contains string like 'foo/bar/zot'. No leading/trailing '/', and separator must be normalized to '/'."

      The implementation in SubversionChangeLogSet.LogEntry.getAffectedPaths() (transitively in the preparePath() metod) compares the path of the change with the unexpanded remote location entry (the 'Repository URL' in the job definition). The 'Repository URL' allows for use of both parameters in parametrized builds (such as ${PARAM} expressions in the Repository URL) and the specification of an optinal revision using the @NNN suffix to the URL. Therefore an affected path will never be recognized if either parameters or revision is used in the Repository URL.

      This issue can be resolved by expanding parameters and truncating the optional revision suffix prior to comparison with the path of change.

      In essence, the current implementation compares (String-based comparison) the change path with a unexpanded remote location like:
      svn://mysvnserver.com/myrepo/${MYPARAM}/myfolder@NNN
      rather than comparison with an expanded and revision-truncated remote location like:
      svn://mysvnserver.com/myrepo/myparametervalue/myfolder

      This issue affects and breaks/limits functionality for at least the Ivy Plugin for Jenkins, which uses this feature (the abstract hudson.scm.ChangeLogSet.Entry.getAffectedPaths() method) to identify the individual Ivy modules within a workspace that are affected by a given change set in the Subversion repository (used for both module-level build triggering and email notification).

      A pull-request with a suggested fix for this issue has been provided via GitHub with reference to this issue: https://github.com/jenkinsci/subversion-plugin/pull/183

            Unassigned Unassigned
            riksen Henrik Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: