0
votes

I was testing to see if jenkins job's retention policy is respected by artifactory. I created a simple Free-Style project and uploaded a build to artifactory with option selected "Discard old builds from Artifactory (requires Artifactory Pro)" and I am using artifactory PRO. The build artifacts and metadata are uploaded and I can see the "Build info json" on artifactory. According to json schem given under "Build info format" section here, there should be a section like:

"buildRetention" : { // Build retention information
    "deleteBuildArtifacts" : true, 
..
..
  },

In my case it is not visible. Am I doing something wrong.

Jenkins: 2.263.4

"artifactoryPluginVersion": "3.11.4"

artifactory: 7.4.3

and I am using generic repository.

1
How exactly you are triggering the build retention? I would recommend referring here to this wiki jfrog.com/confluence/display/JFROG/… - Muhammed Kashif
Thanks for answering and referring to the document. I am doing it the same way as suggested in the document but my question is not about being able to set it, the question is about being able to see it in artifactory UI :) - Muhammad Faizan-Ul-Haq

1 Answers

0
votes

In older versions of the Jenkins Artifactory Plugin, the build retention policy indeed uswd to be included as part of the build-info JSON. Artifactory used to read the information from the build-info JSON whenever a build-info was published, and triggered the retention. Today however, the retention request is no longer sent to Artifactory this way. Instead, Jenkins sends a separate REST request to Artifactory for the build retention, right after the build-info is published. This change decouples these two actions, and by that allows triggering the retention when desired in pipeline jobs. See for example hope this is done using the Artifactory DSL for pipeline jobs. In terms of the retention functionality, it remained the same for Free-Style jobs.

In the contest of build retention, it's also worth mentioning that in Free-Style jobs, in addition to setting the "Discard old builds from Artifactory (requires Artifactory Pro)" option in the UI, you should also configure the build retention under "Discard old builds". In this section you can indicate how long to keep old builds on Jenkins. In Free-Style jobs, this configuration is also used to discard the builds from Artifactory.