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

"Poll Exclude File(s)" option doesn't handle build parameters

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
      Perforce plugin 1.36, Jenkins 1.439
    • Similar Issues:

      Description

      Hi there,

      It appears the "Poll Exclude File(s)" section of the Perforce plugin doesn't support build parameters. In my Perforce view configuration I'm quite happily using something like:

      //mydepot/${branch}/Engine/Include/Macros.h "//workspace/Engine/Include/Macros.h"

      where "branch" is a string parameter specified under the "This build is parameterized" option.

      However, if I enter the following in "Poll Exclude File(s)":

      //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt

      I get:

      ERROR: Failed to record SCM polling
      java.util.regex.PatternSyntaxException: Illegal repetition near index 8
      //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt
                ^
      	at java.util.regex.Pattern.error(Unknown Source)
      	at java.util.regex.Pattern.closure(Unknown Source)
      	at java.util.regex.Pattern.sequence(Unknown Source)
      	at java.util.regex.Pattern.expr(Unknown Source)
      	at java.util.regex.Pattern.compile(Unknown Source)
      	at java.util.regex.Pattern.<init>(Unknown Source)
      	at java.util.regex.Pattern.compile(Unknown Source)
      	at hudson.plugins.perforce.PerforceSCM.doesFilenameMatchP4Pattern(PerforceSCM.java:1112)
      	at hudson.plugins.perforce.PerforceSCM.doesFilenameMatchAnyP4Pattern(PerforceSCM.java:1100)
      	at hudson.plugins.perforce.PerforceSCM.isChangelistExcluded(PerforceSCM.java:1079)
      	at hudson.plugins.perforce.PerforceSCM.getCurrentDepotRevisionState(PerforceSCM.java:1020)
      	at hudson.plugins.perforce.PerforceSCM.compareRemoteRevisionWith(PerforceSCM.java:900)
      	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      	at hudson.scm.SCM.poll(SCM.java:373)
      	at hudson.model.AbstractProject.poll(AbstractProject.java:1326)
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      

      Can this be fixed please?

      Regards,
      Tom.

        Attachments

          Activity

          Hide
          rpetti Rob Petti added a comment -

          I believe that field supports regex, so you can do the following until it's fixed:

          //mydepot/.*/Engine/Tools/Source/StripELF/Readme_e.txt

          I'll try to take a look at it before the holidays start.

          Show
          rpetti Rob Petti added a comment - I believe that field supports regex, so you can do the following until it's fixed: //mydepot/.*/Engine/Tools/Source/StripELF/Readme_e.txt I'll try to take a look at it before the holidays start.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Rob Petti
          Path:
          src/main/java/hudson/plugins/perforce/PerforceSCM.java
          http://jenkins-ci.org/commit/perforce-plugin/aea33143a487fb626c7c90a6dc24c5d200ead0f1
          Log:
          JENKINS-12202 adding substitution support for exclude User/Files fields

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rob Petti Path: src/main/java/hudson/plugins/perforce/PerforceSCM.java http://jenkins-ci.org/commit/perforce-plugin/aea33143a487fb626c7c90a6dc24c5d200ead0f1 Log: JENKINS-12202 adding substitution support for exclude User/Files fields
          Hide
          tfields Thomas Fields added a comment -

          Hi Rob,

          Wow that was quick. Much appreciated. If you could provide an updated plugin I can test this for you tomorrow.

          Regards,
          Tom.

          Show
          tfields Thomas Fields added a comment - Hi Rob, Wow that was quick. Much appreciated. If you could provide an updated plugin I can test this for you tomorrow. Regards, Tom.
          Hide
          dogfood dogfood added a comment -

          Integrated in plugins_perforce #167
          JENKINS-12202 adding substitution support for exclude User/Files fields

          Rob Petti :
          Files :

          • src/main/java/hudson/plugins/perforce/PerforceSCM.java
          Show
          dogfood dogfood added a comment - Integrated in plugins_perforce #167 JENKINS-12202 adding substitution support for exclude User/Files fields Rob Petti : Files : src/main/java/hudson/plugins/perforce/PerforceSCM.java
          Hide
          rpetti Rob Petti added a comment -
          Show
          rpetti Rob Petti added a comment - Here's the latest snapshot: http://files.robpetti.com/perforce-plugin/target/perforce.hpi
          Hide
          tfields Thomas Fields added a comment -

          Hi Rob,

          The new plugin works great. Thanks a lot.

          Regards,
          Tom.

          Show
          tfields Thomas Fields added a comment - Hi Rob, The new plugin works great. Thanks a lot. Regards, Tom.
          Hide
          tfields Thomas Fields added a comment -

          Actually one thing I did notice was that in the project config page it still says this in red:

          Invalid file spec //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt: Illegal repetition near index 8
          //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt

          Works fine though.

          Show
          tfields Thomas Fields added a comment - Actually one thing I did notice was that in the project config page it still says this in red: Invalid file spec //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt : Illegal repetition near index 8 //mydepot/${branch}/Engine/Tools/Source/StripELF/Readme_e.txt Works fine though.
          Hide
          tfields Thomas Fields added a comment -

          Hi Rob,

          Any ideas about my last comment?

          Regards,
          Tom.

          Show
          tfields Thomas Fields added a comment - Hi Rob, Any ideas about my last comment? Regards, Tom.
          Hide
          rpetti Rob Petti added a comment -

          I thought it worked fine? I might be able to fix the validation, but I kinship of doubt it, since the user may be using parameters that have not yet been saved in the configuration.

          – Posted from Bugbox for Android

          Show
          rpetti Rob Petti added a comment - I thought it worked fine? I might be able to fix the validation, but I kinship of doubt it, since the user may be using parameters that have not yet been saved in the configuration. – Posted from Bugbox for Android
          Hide
          tfields Thomas Fields added a comment -

          It does work fine. It just looks odd when it throws up that warning. I don't get the same warning when i use the ${} syntax in the View mapping.

          Cheers,
          Tom.

          Show
          tfields Thomas Fields added a comment - It does work fine. It just looks odd when it throws up that warning. I don't get the same warning when i use the ${} syntax in the View mapping. Cheers, Tom.
          Hide
          rpetti Rob Petti added a comment -

          The main difference there is that the View map is not a regex. The exclude files and users options are validated by parsing the regex, which fails in this instance because the parameters are not replaced when doing so. I could attempt to replace them with the default values, but you'll still run into the situation where unsaved parameters are not replaced during validation, which will result in the same error.

          Show
          rpetti Rob Petti added a comment - The main difference there is that the View map is not a regex. The exclude files and users options are validated by parsing the regex, which fails in this instance because the parameters are not replaced when doing so. I could attempt to replace them with the default values, but you'll still run into the situation where unsaved parameters are not replaced during validation, which will result in the same error.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Rob Petti
          Path:
          src/main/java/hudson/plugins/perforce/PerforceSCM.java
          http://jenkins-ci.org/commit/perforce-plugin/106e85b309ab4d82c93656e980eb5302a70c15eb
          Log:
          [FIXED JENKINS-12202] fixed validation on exclude fields

          we're now assuming that all ${} constructs are valid variables, and thus replacing them with a dummy value before attempting to validate

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rob Petti Path: src/main/java/hudson/plugins/perforce/PerforceSCM.java http://jenkins-ci.org/commit/perforce-plugin/106e85b309ab4d82c93656e980eb5302a70c15eb Log: [FIXED JENKINS-12202] fixed validation on exclude fields we're now assuming that all ${} constructs are valid variables, and thus replacing them with a dummy value before attempting to validate
          Hide
          dogfood dogfood added a comment -

          Integrated in plugins_perforce #174
          [FIXED JENKINS-12202] fixed validation on exclude fields (Revision 106e85b309ab4d82c93656e980eb5302a70c15eb)

          Result = SUCCESS
          Rob Petti :
          Files :

          • src/main/java/hudson/plugins/perforce/PerforceSCM.java
          Show
          dogfood dogfood added a comment - Integrated in plugins_perforce #174 [FIXED JENKINS-12202] fixed validation on exclude fields (Revision 106e85b309ab4d82c93656e980eb5302a70c15eb) Result = SUCCESS Rob Petti : Files : src/main/java/hudson/plugins/perforce/PerforceSCM.java

            People

            • Assignee:
              rpetti Rob Petti
              Reporter:
              tfields Thomas Fields
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: