Hello Team,
I am trying to implement on my existing pipeline to limit the number of build stored in artifactory however it is not working .
A “log rotation” strategy should be implemented in the Jenkins pipeline to only store the last 5 builds This change should be made in the pipeline script itself .
stage("Artifactory Upload") {
def directory = "generic-local/ABC/XYZ/${params['version']}/${currDate}/${buildNo}/"
def server = Artifactory.server 'art-int'
def upload_spec_bin = """{
"files": [
{
"pattern": "*",
"target": "${directory}",
"exclusions": ["*.txt"]
}
]
}"""
build_info = server.upload spec: upload_spec_bin
build_info.retention maxBuilds: 5,deleteBuildArtifacts: true
server.publishBuildInfo build_info
}