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

Usage of parameters as branches in View mappings of Perforce plugin does not work for P4 polling

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • jenkins 2.89.4, p4 plugin 1.11.3

      If branch is defined as parameter, e.g.

      TC_BRANCH=//depot/path1

      and then that parameter is used in p4 view mappings, e.g. 

      ${TC_Branch}/... //myworkspace/...

      the p4 polling functionality fails with following error:

      Error in client specification.

      Mapping '/...' is not under '//USER/...'.

       

      P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.

      Mapping '/...' is not under '//USER/...'.

       

                     at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:151)

                     at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:102)

                     at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:212)

                     at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1522)

                     at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:516)

                     at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:181)

                     at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:160)

                     at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:100)

                     at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:166)

                     at org.jenkinsci.plugins.p4.tasks.PollTask.invoke(PollTask.java:50)

                     at org.jenkinsci.plugins.p4.tasks.PollTask.invoke(PollTask.java:33)

                     at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2760)

                     at hudson.remoting.UserRequest.perform(UserRequest.java:181)

                     at hudson.remoting.UserRequest.perform(UserRequest.java:52)

                     at hudson.remoting.Request$2.run(Request.java:336)

                     at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)

                     at java.util.concurrent.FutureTask.run(FutureTask.java:266)

                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

                     at hudson.remoting.Engine$1$1.run(Engine.java:98)

                     at java.lang.Thread.run(Thread.java:748)

       

      ERROR: P4: Task Exception: Error in client specification.

      Mapping '/...' is not under '//USER/...'.

       

      Finished: FAILURE

       

      This funcionality is working fine with old Perforce plugin.

      We are using the branches as parameters as we reference this parameter in multiple places within the job, e.g. pass it to another job or use it in jelly.script for branches to be displayed in email

       

          [JENKINS-66147] Usage of parameters as branches in View mappings of Perforce plugin does not work for P4 polling

          Karl Wirth added a comment -

          For Dev - Have confirmed this behavior with Sylwia.

          Current polling must have a defined branch otherwsie it doesnt know what to poll for. Cannot figure out how the deprecated plugin knows what to poll for? Possibly it has the equivalent of syncID for every paramater that has ever been specified?

          Multibranch is the solution is you want everything under atree to be polled for but that requires coding and mass changes of all jobs.

          Reproduction Steps:

          • Add files to //depot/path1/... in Perforce.
          • Create a Freestyle job with variable TC_BRANCH. Set default to be '//depot/path1'.
          • Workspace should be type manual and contain 'View Mapping' set to '${TC_BRANCH}/... //${P4_CLIENT}/...
          • Set job to be polled (Poll SCM).
          • Run job manually.
          • Submit an update to a file under //depot/path1/... in Perforce.
          • Run 'Poll Now' (if you have that plugin) or wait till next polling interval.
          • See error:

           

          P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
          Mapping '/...' is not under '//depot/...'.
          

           

           

          Karl Wirth added a comment - For Dev - Have confirmed this behavior with Sylwia. Current polling must have a defined branch otherwsie it doesnt know what to poll for. Cannot figure out how the deprecated plugin knows what to poll for? Possibly it has the equivalent of syncID for every paramater that has ever been specified? Multibranch is the solution is you want everything under atree to be polled for but that requires coding and mass changes of all jobs. Reproduction Steps: Add files to //depot/path1/... in Perforce. Create a Freestyle job with variable TC_BRANCH. Set default to be '//depot/path1'. Workspace should be type manual and contain 'View Mapping' set to '${TC_BRANCH}/... //${P4_CLIENT}/... Set job to be polled (Poll SCM). Run job manually. Submit an update to a file under //depot/path1/... in Perforce. Run 'Poll Now' (if you have that plugin) or wait till next polling interval. See error:   P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification. Mapping '/...' is not under ' //depot/...' .    

          p4karl The deprecated Perforce plugin is polling for all changes since last build CLs in all the branches defined in View Mapping. If it finds parameter in left part of view mappings , it substitutes that parameter with parameter value which in this case is always branch.

          Sylwia Kludacz added a comment - p4karl The deprecated Perforce plugin is polling for all changes since last build CLs in all the branches defined in View Mapping. If it finds parameter in left part of view mappings , it substitutes that parameter with parameter value which in this case is always branch.

          Jose added a comment -

          We have the same problem. Is it going to be solved? How did you solve it Sylwia?

          Jose added a comment - We have the same problem. Is it going to be solved? How did you solve it Sylwia?

          Unfortunately Jose this has not been resolved  

          we are still using old perforce plugin 1.3.17 and were unable to migrate to new P4 plugin because of this issue. 

          We are using branches as parameters in most of our release jobs so P4 plugin can't be used having this issue.

          Our jenkins upgrade is also not possible as in later jenkins releases perforce pugin was deprecated and replaced by P4 plugin.

           

          Sylwia Kludacz added a comment - Unfortunately Jose this has not been resolved   we are still using old perforce plugin 1.3.17 and were unable to migrate to new P4 plugin because of this issue.  We are using branches as parameters in most of our release jobs so P4 plugin can't be used having this issue. Our jenkins upgrade is also not possible as in later jenkins releases perforce pugin was deprecated and replaced by P4 plugin.  

          Jose added a comment -

          Well, it is a problem.
          Anyway, testing, in a jenkins task where we had a problem with the parameters in "View mappings", what we did was to set None as SCM source and save the job. Then reconfigure the SCM as Perforce with the P4 plugin and it works. Mysteries of computing

          Jose added a comment - Well, it is a problem. Anyway, testing, in a jenkins task where we had a problem with the parameters in "View mappings", what we did was to set None as SCM source and save the job. Then reconfigure the SCM as Perforce with the P4 plugin and it works. Mysteries of computing

            Unassigned Unassigned
            skl Sylwia Kludacz
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: