My team has recently started using the interactive promotion feature of the Jenkins Artifactory plugin to start from build-output
to qa-ready
. I've included our upload script at the bottom for reference. This has been an easy and very effective way to handle our promotion process. We are still new to Artifactory in general as well.
We use build retention policies which work on build-output
as expected. However, the builds that get promoted to qa-ready
don't have build retention policies on them once in qa-ready
so they just pile up until someone manually deletes them. According to the documentation there isn't a direct way via the addInteractivePromotion
command but is there a different way to implement build retention policy on promoted builds in their new location?
We're using Artifactory Pro 6.5.3.
void uploadToArtifactory(String fileFullPath) {
//build retention
def buildInfo = Artifactory.newBuildInfo()
buildInfo.retention maxBuilds: 5, deleteBuildArtifacts: true
def artifactory_server = Artifactory.server 'artifactory'
def upload_spec = """{
"files":[
{
"pattern": \"""" + fileFullPath + """\",
"target": \"build-output/${ProductVersion}/\",
"regexp": "true"
}
]
}"""
def promotion_config = [
'buildName': buildInfo.name,
'buildNumber': buildInfo.number,
'targetRepo': 'qa-ready'
]
Artifactory.addInteractivePromotion(server: artifactory_server, promotionConfig: promotion_config)
artifactory_server.upload(upload_spec, buildInfo)
artifactory_server.publishBuildInfo(buildInfo)
}