Skip to content

Remove artifacts from S3 for deleted pipelines#349

Merged
alecharp merged 1 commit intojenkinsci:masterfrom
gilgameshfreedom:remove-artifacts-for-deleted-pipelines
Sep 23, 2025
Merged

Remove artifacts from S3 for deleted pipelines#349
alecharp merged 1 commit intojenkinsci:masterfrom
gilgameshfreedom:remove-artifacts-for-deleted-pipelines

Conversation

@gilgameshfreedom
Copy link

Currently, the s3-plugin plugin deletes the artifacts from S3 only if the corresponding build has been deleted. However, if a job (pipeline) is deleted, the artifacts that were uploaded to S3 by its builds will remain there indefinitely (unless they are manually deleted from S3).

For example, in our environment we actively use the plugin with multi-branch pipelines - for every PR a pipeline is created automatically. When the PR is closed, the corresponding pipeline is deleted automatically, but the artifacts are still kept on S3. As a result, we accumulate a lot of unnecessary data and we need to clean them manually.

This PR adds a new option to the S3 profile - deleteArtifactsRecursively. When enabled (by default it's false), the plugin deletes the artifacts recursively if a pipeline (or a folder / organization folder) is deleted.

@gilgameshfreedom
Copy link
Author

@rsandell @olamy @basil please have a look at PR.

@gilgameshfreedom
Copy link
Author

The PR check build is failed, but it looks like it happened not because of my changes

22:44:52  ERROR: Issue with creating launcher for agent EC2 (aws-us-east-2) - Spot Windows 2019 x86_64 with JDK21 (i-03c817627f6073e57). The agent has not been fully initialized yet

@gilgameshfreedom
Copy link
Author

Please review the PR someone.

Copy link
Member

@alecharp alecharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a code point of view, this looks ok.
I haven't tested the code and don't have the infra to do so.

@gilgameshfreedom gilgameshfreedom force-pushed the remove-artifacts-for-deleted-pipelines branch from 9b3dc91 to 3fd6801 Compare September 16, 2025 08:26
@alecharp
Copy link
Member

Please, don't force push on pull request where someone started to review the content.

1 similar comment
@alecharp
Copy link
Member

Please, don't force push on pull request where someone started to review the content.

@gilgameshfreedom
Copy link
Author

Please, don't force push on pull request where someone started to review the content.

Ok. Won't do it in the future.

@gilgameshfreedom
Copy link
Author

Hi @alecharp. Since the PR was approved may you merge it to trigger a new release?

@gilgameshfreedom
Copy link
Author

Hi @rsandell or maybe you could merge the PR to trigger a build of a new release?

@rsandell rsandell added the bug label Sep 19, 2025
@rsandell rsandell added this pull request to the merge queue Sep 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 19, 2025
@gilgameshfreedom
Copy link
Author

github-merge-queue bot removed this pull request from the merge queue due to failed status checks)

@rsandell it looks like the build has been failed not because of the changes in that PR and the build's logs are not available anymore to get an exact answer. Maybe the problem was the same like here - https://ci.jenkins.io/job/Plugins/job/s3-plugin/view/change-requests/job/PR-349/1/

May I ask you try merging it again?

@alecharp alecharp added this pull request to the merge queue Sep 23, 2025
Merged via the queue into jenkinsci:master with commit 7e55f37 Sep 23, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments