• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • artifactory-plugin
    • None

      I'm not sure whether this was meant to work like it is now.

      I use the Jenkins Artifactory Plugin to publish the build info of my C#-Project's builds to artifactory. I used to have a retention policy which allowed to keep 3 versions of the artifact. 

      Then we decided to keep all artifacts, so I removed the part of the code from my pipeline which set the retention policy

      buildInfo.retention maxBuilds: 3, deleteBuildArtifacts: true
      

      I expected that this would stop artifactory from applying the retention policy to all subsequent builds so that from the moment when the new pipeline was used, all artifacts published from those subsequent builds would be kept forever.

      But after a week I recognized that still only 3 artifacts are kept in artifactory. 

      Now I think I have to modify and enable the above code again so that maxBuilds is set to a value where it will keep all artifacts (which one would be correct? 0 or -1). 

      If the behaviour described above is correct, the documentation should contain a warning.

      Otherwise, I would expect the default behaviour to be that it doesn't delete anything from a build when the retention policy was not explicitly set with that build

       

          [JENKINS-45848] Retention policy is kept after removing it

          I can't see how a Pipeline script that doesn't include build retention, could cause those builds to be deleted.

          The build retention method, simply invokes a REST API of Artifactory, which triggers an on demand build retention.

          I assume that there's something else that causes your builds to be discarded.

          Eyal Ben Moshe added a comment - I can't see how a Pipeline script that doesn't include build retention, could cause those builds to be deleted. The build retention method, simply invokes a REST API of Artifactory, which triggers an on demand build retention. I assume that there's something else that causes your builds to be discarded.

          Christian H added a comment -

          Maybe the cause was the following:

           

          I had one job that sequentially first built a nuget package and published it to artifactory and then built a maven artifact and published it to artifactory. A build info was created and published for both of the artifacts. Maybe the java-part build info created the retention policy on the nuget artifact. The build info published for the nuget artifact didn't have a retention policy while the java-part build info had the retention policy mentioned above:

           

          buildInfo.retention maxBuilds: 3, deleteBuildArtifacts: true
          

          Christian H added a comment - Maybe the cause was the following:   I had one job that sequentially first built a nuget package and published it to artifactory and then built a maven artifact and published it to artifactory. A build info was created and published for both of the artifacts. Maybe the java-part build info created the retention policy on the nuget artifact. The build info published for the nuget artifact didn't have a retention policy while the java-part build info had the retention policy mentioned above:   buildInfo.retention maxBuilds: 3, deleteBuildArtifacts: true

          If indeed you used the same build info instance to aggregate the two builds, and you still have code that sets the build retention on this build info instance, then this could explain this.

          Eyal Ben Moshe added a comment - If indeed you used the same build info instance to aggregate the two builds, and you still have code that sets the build retention on this build info instance, then this could explain this.

            eyalbe Eyal Ben Moshe
            codingspiderfox Chris H
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: