-
Bug
-
Resolution: Fixed
-
Major
- Create pipeline job that uses pipeline script via SCM (using p4plugin):
pipeline { agent { label 'master' } stages { stage("Repro") { steps { script { sh "pwd" sh "ls -l" sh "if [ -e this_should_be_cleaned_up ]; then false; else true; fi" input(message: "Fake input to reproduce, please DO NOT proceed, just start another build of this job", parameters: [booleanParam(defaultValue: false, description: "", name: "Mocked choice")]) sh "touch this_should_be_cleaned_up" } } } } }
- Set the quiet period of job to 0.
- Start job twice
- One job will fail with following error:
Lightweight checkout support not available, falling back to full checkout. Checking out PERFORCE_REPO_PATH //jenkins-${NODE_NAME}-${JOB_NAME}/... into /var/lib/jenkins/workspace/JOB_NAME@script to read Jenkinsfile.groovy ... p4 client -o jenkins-master-JOB_NAME + ... p4 info + ... p4 client -o jenkins-master-JOB_NAME + ... p4 client -i + ... client: jenkins-master-JOB_NAME ... p4 client -o jenkins-master-JOB_NAME + ... p4 info + ... p4 counter change + ... p4 changes -m1 -ssubmitted //jenkins-master-JOB_NAME/... + Building on Node: master ... p4 client -o jenkins-master-JOB_NAME + ... p4 info + P4 Task: establishing connection. ... server: PERFORCE_SERVER ... node: NODE P4 Task: reverting all pending and shelved revisions. ... p4 revert /var/lib/jenkins/workspace/JOB_NAME%40script/... + ERROR: P4JAVA: Error(s): Path '/var/lib/jenkins/workspace/JOB_NAME%40script/...' is not under client's root '/var/lib/jenkins/workspace/JOB_NAME'. Finished: FAILURE
If cannot reproduce - start job multiple times with some small time intervals between clicks. Clearly there is some race condition for access to JOB_NAME@script workspace directory - sometimes it succeeds, sometimes doesn't.
Please note that this is not a duplicate for JENKINS-45339, even though the reproduction is very similar. In JENKINS-45339 you should wait for input to start second build (i.e. wait for the pipeline script to be checked out before starting second build). Over here, the builds should be started right away, before it goes to "Declarative: Checkout SCM" stage.
I'm not entirely sure if the issue is unique for P4 Plugin - it may be the case that whole "Pipeline script from SCM" feature has architectural flaw. I think there should be multiple @script directories created, for every concurrent build. There are multiple @tmp dirs, but the @script is shared between concurrent builds.
I can reproduce this with lightweight checkout enabled as well.