-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.235.5
Docker container
Context
Here is our global shared Lib configuration :
Here, code from our shared library, from different versions :
CppPipeline.groovy - trunk, HEAD revision (SVN)
def branches = [:] config.targets.each{ branches[it] = { node ( it ){ properties([ buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')), pipelineTriggers([[$class:"SCMTrigger", scmpoll_spec: 'H 0 * * *']]), ]) yeah_do_things(it) } } }
CppPipeline.groovy - trunk, older revision (SVN)
def branches = [:]
config.targets.each{
branches[it] = {
node ( it ){
// NOTHING HERE
yeah_do_things(it)
}
}
}
Issue
From my branch's Jenkinsfile, if I swtich from recent Shared Lib to an older one, properties are not cleared properly.
Switch from recent Shared Lib
@Library("cpp-pipeline@trunk") _
this revision contains 'pipelineTriggers' and 'buildDiscarder' properties
to older Shared Lib
@Library("cpp-pipeline@trunk@5000") _
this revision do not contains any properties
But job's branch config.xml still contains old properties and is not cleared, even after manual build and Pipeline Scan.
Exceptations
Job Properties should be cleared if not specified and not using cache from old builds.
A workaround we use
To prevent this issue, a tag of Shared Lib have been created as a reference of the old version, with this following hotfix :
CppPipeline.groovy - old revision tag + hotfix (SVN)
def branches = [:]
config.targets.each{
branches[it] = {
node ( it ){
// Clear properties to prevent cached propeties
properties([])
yeah_do_things(it)
}
}
}
this revision gratantee to not contains any properties with properties([]) set to empty array