Unpublishing build artifacts

15 views
Skip to first unread message

Tim Van Holder

unread,
Mar 31, 2021, 7:20:48 PM3/31/21
to jenkin...@googlegroups.com
Hi,

I'm looking at adding support for unpublishing build artifacts.

Basically, our .NET-based jobs create NuGet packages which are added as artifacts for the run but also pushed to a package server.

For our non-release CI jobs, I want to look at automating cleanup so that when the job is deleted, the packages are also removed from the package server.
This would ensure that a retention policy is only needed in Jenkins, not also in the package server.

I'm running into two problems:
- reacting to the job delete using RunListener works, and I can see the package artifacts in
  order to determine which package(s) need unpublishing.
  - However, I don't immediately see a means for storing information on the Run when doing the
    push (like the server used) that can be picked up on the delete.
- it's also possible to delete the artifacts without deleting the entire run; however, there does not
  seem to be a way to react to that at all.
  - I also assume (but have not tested) that deleting the artifacts deletes the whole artifact, not just
    the file data, so I would not be able to see that there used to be a package there when the job
    is deleted.

Any suggestions/ideas?

Slide

unread,
Mar 31, 2021, 9:35:31 PM3/31/21
to jenkin...@googlegroups.com
You could add an Action to the Run (https://javadoc.jenkins-ci.org/hudson/model/Run.html#addAction-hudson.model.Action-) to store information about the artifact location on the server. Then when you are getting a delete, you could look for the Action and pull the necessary information from there.


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--DddQ2LjR-f9qWbYBdOVAb-BBSdnUCPvw8EAowA%3DJH6cw%40mail.gmail.com.


--
Reply all
Reply to author
Forward
0 new messages