p4paul sorry to bump a very old issue, but how can I use your fix when I'm using raw p4groovy to do more advanced stuff?
I have a function called get_synced_changelist() that does exactly what the name implies. This code works fine except if the job runs on an executor other than 0. If that happens, Jenkins appends '@2' to the workspace and p4groovy crashes when it tries to use that as the workspace root.
Unless I'm missing something, I don't see any way to specify the client's root at the time of instantiation, so I don't know how to avoid this bug.
Here's the code. The best way to repro this is to pin your job to a certain node, then Build it rapidly a few times (ensuring concurrent builds). Any build NOT on the first executor will fail.
def get_synced_changelist(String p4_credential_name, String client_name, String p4_stream) {
def ws = [$class: 'StreamWorkspaceImpl', charset: 'none', format: client_name, pinHost: false, streamName: p4_stream]
def p4 = p4(credential: p4_credential_name, workspace: ws)
changelist = p4.run( 'changes', '-m1', "@"+ p4.getClientName() )
return changelist[0].change
}
get_synced_changelist('p4tools', 'jenkins-${NODE_NAME}${JOB_NAME}${EXECUTOR_NUMBER}', '//depot/stream_name')
Somewhat related:
JENKINS-25242. Same issue with "@" in the path.