jfrog / jenkins-artifactory-plugin

Jenkins artifactory plugin
http://jenkins-ci.org/
115 stars 187 forks source link

Build retention does not working for Matrix jobs #219

Open Caipers opened 4 years ago

Caipers commented 4 years ago

Hi,

We use Artifactory plugin with Matrix jobs and the build retention policy is not respected. The problem to us is that the Artifactory plugin is not deleting the files in our Artifactory server.

We are setting the feature on for "Discard old builds from Artifactory (requires Artifactory Pro)" and also "Discard build artifacts".

Inside of the Matrix jobs, it looks Artifactory is properly initialized: "10:19:33 Jenkins Artifactory Plugin version: 3.4.1"

Also, it is deploying the build info: "10:19:47 Deploying build info to: https://ourjenkinsserver/artifactory/api/build"

But one thing I noticed, there is NO mention about applying the build retention policy, something like "Sending request for build retention, deleting build artifacts, max number of builds to store: 10.". So, maybe the build retention policy is not enforced.

Any idea?

adim1 commented 4 years ago

Steps to reproduce: Artifactory: 6.16 Artifactory Jenkins Plugin: 3.6.0

  1. Set a multi-configuration project.
  2. Set 'Discard old builds' in the Jenkins configuration.
  3. Set the deployment of the Artifacts to Artifactory with Maven3 integration.
  4. Set 'Discard builds' according to the Jenkins policy.
  5. Run the project above the number of times to discard builds.

Observed result: Artifactory saves each build even above the discard old builds setting.

Expected: Artifactory removes the older builds according to the discard setting.

barbelity commented 4 years ago

Thanks for reporting this issue @Caipers. The bug was caused by an error while receiving the 'Discard old builds' strategy defined in a Multi-configuration project. We pushed this commit to fix it, and a 'snapshot' version of the plugin can be downloaded from here. Your feedback for it is highly appreciated.

swapnilpotnis commented 4 years ago

@barbelity : Mine isn't multi-project, but i am using Scripted Pipeline in Jenkins and trying to delete docker images artifact from jfrog's docker registry but facing the following error:

Sending request for build retention, deleting build artifacts, max number of builds to store: 10. Failed to execute build retention.

using jfrogs command: buildInfo.retention maxBuilds: 10, deleteBuildArtifacts: true

Any clue what might be the issue?