jenkinsci/plasticscm-plugin

Full repository checkout when using lightweight checkout option to get declarative pipeline in Jenkinsfile

tomyknocker opened this issue · 1 comments

Jenkins makes repository checkout after obtaining JenkinsFile with declarative pipeline and option "Lightweight checkout" is checked. There is no cm command in the pipeline. Issue is not present when there is scripted pipeline in the JenkinsFile

Windows 10
Jenkins 2.176.3
plasticscm plugin 3.3 (issue observed also on version 3.2)

project configuration (Update option does not change this behavior):
image

pipeline in JenkinsFile:
pipeline { agent none stages { stage("Preparation") { agent {node 'master'} steps { script { print "test" } } } } }

build log:
Started by user Administrator
Running as Administrator
Obtained SCRIPTS/JenkinsFile_test.groovy from Plastic SCM repository "100test@plasticscm_prod1.xxx.net:8087" path "/" smartbranch "/main/jenkins"
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] stage
[Pipeline] { (Preparation)
[Pipeline] node
Running on Jenkins in C:\Jenkins\jobs\workspace\plastictest
[Pipeline] {
[Pipeline] checkout
[plastictest] $ cm lwk --format={wkname}#{path}#{wkid}
jenkins_a0c5e0323d4a4d8c94534bf1a140c256#c:\Jenkins\jobs\workspace\test2\J#ef704f7d-be75-4bd8-927f-31a5da6ff444
jenkins_a5f207e0ab6249cb94ee03f513e446d0#c:\Jenkins\jobs\workspace\plastictest@script#9fc36fc8-0f56-4c13-9b4e-5cf3053c4aff
jenkins_e537166dbf834c859ea7ffbeef7c3097#c:\Jenkins\jobs\workspace\plastictest#513b4f77-35a2-4506-a0ef-315f490bf310
[plastictest] $ cm rmwk c:\Jenkins\jobs\workspace\plastictest
The workspace jenkins_e537166dbf834c859ea7ffbeef7c3097 has been deleted.
[plastictest] $ cm mkwk jenkins_17c25de1bd1e4eedb0079452084dda9f C:\Jenkins\jobs\workspace\plastictest --selector=C:\Jenkins\jobs\workspace\plastictest\selector6230678382920827939.txt
Workspace jenkins_17c25de1bd1e4eedb0079452084dda9f has been correctly created
[plastictest] $ cm gwp C:\Jenkins\jobs\workspace\plastictest --format={0}#{1}#{4}
jenkins_17c25de1bd1e4eedb0079452084dda9f#c:\Jenkins\jobs\workspace\plastictest#35ffcd98-c340-4a3e-9ff9-1b015d55d326
[plastictest] $ cm unco --all --silent c:\Jenkins\jobs\workspace\plastictest
[plastictest] $ cm update c:\Jenkins\jobs\workspace\plastictest
...

mig42 commented

Hi @tomyknocker ,

The "Lightweight checkout" option only applies to the preliminary operation that Jenkins performs to retrieve the Jenkins script. In your case, it's SCRIPTS/JenkinsFile_test.groovy. As far as the Lightweight checkout is involved, in the log you shared there's a workspace at c:\Jenkins\jobs\workspace\plastictest@script. That's the workspace used to retrieve the script.

The build log you shared corresponds to the actual build results. In it, we can see that the plugin removes an existing workspace and then creates it in the same place. This indeed triggers a full sources checkout, but this can happen for multiple reasons, e.g. changing the target repository from one build to the next.