-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins v2.346.3
P4 Plugin v1.13.0
Error logged when schedule poll changes in the SCM and using variables in Stream Codeline field
Steps:
- Create a Free Style Project
- Choose 'This project is parameterized'.
- Create a 'String' parameter with name 'STREAM' and a default value of a known stream (e.g. '//streams/main/project/version').
- Under 'Source Code Management' choose 'Perforce Software', enter the credentials
- Under Workspace behavior 'Streams'.
- Set 'Stream Codeline' to ${STREAM}'.
- Under 'Build Triggers', enable Poll SCM, Set Schedule to poll every 5 minutes 'H/5 * * * *'
- Save.
- Choose 'Build with Parameters' to build once or wait the first polling triggered successfully
- After 1st successful build, wait 5 minutes for the next polling, following is logged in the Perforce Software Polling Log.
P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification. Error detected at line 18. Stream 'STREAM' must begin with '//'. 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:1784) at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:524) at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:191) at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:170) at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:104) at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:171) 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.act(FilePath.java:1200) at hudson.FilePath.act(FilePath.java:1183)
Note:
- Issue is similar to
JENKINS-56775but only poll SCM has this issue. Triggering build manually is successful and no such error logged. - Tried to set stream variables without "//" characters and find the parameters is not replaced
- set variable STREAM1 = streams
- set variable STREAM2 = main/project/version
- set the Stream Codeline to //${STREAM1}/${STREAM2}
- following error is logged in the polling log and seems the variable is not replaced
P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification. Stream '//STREAM1/STREAM2' doesn't exist. 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)
- duplicates
-
JENKINS-55020 poll using build parameters
-
- Open
-
Hi winniechoi
Polling will never work with variable paths. When polling runs how does it know what to poll?
For example I run job once against:
//stream/main
then against:
//stream/rel1
then against:
//stream/rel2
How does the job know which one you want to poll on? Do you want to look for changes in main, all of them or a new branch that has not been manually built yet?
The P4-Plugin is designed to only poll against fixed branches per job. For example if it's a freestyle job there is only one sync so polling can only occur against that path. If it's a pipeline with 3 p4sync/checkout steps it will poll against the 3 fixed paths in the job.
If you want polling against variable branches then we suggest using multibranch instead:
https://www.lambdatest.com/blog/how-to-create-jenkins-multibranch-pipeline/
An alternative is to have a change commit trigger in Perforce that calls the build URL passing in the stream you want to build as a variable to the job.
https://www.perforce.com/manuals/p4sag/Content/P4SAG/scripting.triggers.submits.commit.html#:~:text=Use%20the%20change-commit%20trigger,successful%20submission%20of%20a%20changelist.
I have marked this case as a duplicate of the enhancement request JENKINS-55020 asking for parameter based polling and will also update that job.
Regards,
Karl