artifactory-cleanup icon indicating copy to clipboard operation
artifactory-cleanup copied to clipboard

KeepLatestNFilesInFolder not working properly when more than one repository is selected

Open afolgado opened this issue 3 years ago • 1 comments

Hi all,

When filtering by RepoByMask instead of Repo, multiple repositories could be selected.

In this case, the rule KeepLatestNFilesInFolder won't work properly because doesn't use the repository name for grouping the artifacts: https://github.com/devopshq/artifactory-cleanup/blob/master/artifactory_cleanup/rules/keep.py#L134

My proposal is to modify it to something like this:

        for artifact in result_artifact:
            path = '{repo}/{path}'.format(**artifact)
            artifacts_by_path[path].append(artifact)

It would be nice to add the repo name to this print too: https://github.com/devopshq/artifactory-cleanup/blob/master/artifactory_cleanup/rules/keep.py#L146

Thanks for this awesome tool!

afolgado avatar Sep 15 '22 13:09 afolgado

@afolgado hi, thank you for providing the feedback! Yep, it looks like a bug.

Feel free to create a PR for suggested changes and the solution for the bug!

allburov avatar Sep 26 '22 06:09 allburov