plawniczuk - Thanks for the data. I was able to reproduce this and the problem is the implicit unshelve caused by 'Build Review' assumes you have given control of the workspace to Jenkins and is seperate to the sync step which as you show above does skip the sync correctly.
Can you please expand on what setting the variables does for you please and why you then perform operations outside the build job against the same workspace.
Note for QA - Reproduction steps:
(1) Create a static workspace on the Jenkins build machine and sync and open for edit files. For example:
$ p4 client -o
Client: STATIC
Update: 2022/01/17 14:11:06
Access: 2022/01/17 14:15:47
Owner: super
Description:
Root: /var/lib/jenkins/workspace/STATIC
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submitunchanged
LineEnd: local
View:
(2) Submit a Jenkinsfile as '//depot/project1/static/main/Jenkinsfile' ensuring your Perforce credential is called 'JenkinsCredential':
pipeline {
agent {
node {
label 'master'
}
}
triggers {
p4Trigger()
}
options {
buildDiscarder logRotator(numToKeepStr: '31')
disableResume()
disableConcurrentBuilds()
timestamps()
skipDefaultCheckout()
}
stages {
stage('Setup Pipeline'){
steps {
checkout perforce(
credential: 'JenkinsCredential',
populate: previewOnly(
quiet: true
),
workspace: staticSpec(
charset: 'utf8',
name: 'STATIC',
pinHost: false
)
)
}
}
stage('Test'){
steps {
echo 'Test'
}
}
}
}
(3) In Jenkins create a pipeline job with Jenkinsfile from SCM.
(4) Build job manually once. No files in workspace are changed.
(5) Shelve a file for path '//depot/project1/static/main/...'
(6) In Jenkins using 'Build Review' , specify shelve changelist number from step (5) under 'review' and 'shelved' under 'status'.
(7) Result is the preview sync runs then shelve is unshelved with 'p4 revert':
14:15:47 P4 Task: syncing files at change: 286 # Correct behaviour of preview sync.
14:15:47 P4 Task: skipping sync.
14:15:47 duration: (0ms)
14:15:47
14:15:47 P4 Task: unshelve review: 287
14:15:47 (p4):cmd:... p4 unshelve -f -s287 -cdefault # This needs to update have list
14:15:47 (p4):stop:5
14:15:47 14:15:47 ... duration: (10ms)
14:15:47 (p4):cmd:... p4 revert -k /var/lib/jenkins/workspace/STATIC/... # This reverts manually opened files.
14:15:47 (p4):stop:6
14:15:47 P4: saving built changes.
Hi plawniczuk - Can you please send me the job definition in Jenkins and your Jenkinsfile. I'm trying to decide if we are falling back to implict sync. If they contain confidential information please send them to support@perforce.com
for my attention.
Thanks in advance,
Karl