devopshq/artifactory-du

AD: We want artifactory-cleanup-rules!

allburov opened this issue · 7 comments

copy-past from README.md#ad

We also have python-script for Artifactory intelligence cleanup rules with config format like this:

GOOD_FILTER_PATH_SYMBOLS = [
    r'*release*', r'*/r-*',
    r'*master*',
    r'*stable*',
]

RULES = [
    {'name': 'Clean all *.tmp',
     'rules': [
         rules.repo_by_mask('*.tmp'),
         rules.delete_older_than_n_days(7),
     ]},

    {'name': 'Clean all *.BANNED after 7 days',
     'rules': [
         rules.repo_by_mask('*.BANNED'),
         rules.delete_older_than_n_days(7),
     ]},

    {'name': 'Clean all *.snapshot after 30 days',
     'rules': [
         rules.repo_by_mask('*.snapshot'),
         rules.delete_older_than_n_days(30),
     ]},

     {'name': 'tech-symbols',
     'rules': [
         rules.repo, # repo-name like 'name'
         rules.delete_older_than_n_days(30),
         rules.filter_without_path_mask(GOOD_FILTER_PATH_SYMBOLS),
         rules.filter_without_filename_mask(GOOD_FILTER_PATH_SYMBOLS),
         rules.filter_by_filename_mask('*-*symbols.tar.gz'),
         rules.without_downloads()
     ]},

     {'name': 'docker-scmdev',
     'rules': [
         rules.repo, # repo-name like 'name'
         rules.filter_by_path_mask('scmdev.test*'),
         rules.delete_images_older_than_n_days(1),
     ]},
]

If you want it, please vote for issue and we will schedule time for move project to open-source: #2

please commit your clean-up script :)

Note that there are also a bunch of cleanup plugins available at:
https://github.com/jfrog/artifactory-user-plugins/tree/master/cleanup
And https://github.com/jfrog/artifactory-user-plugins/tree/master/archive/archiveOldArtifacts

I found https://github.com/jfrog/artifactory-user-plugins/tree/master/archive/archiveOldArtifacts to be most useful, I extended it to also support moving the artifacts disk, this way you can really "archive" old artifacts to another disk instead of just deleting them. I will submit these changes to the repo above soon. But already cleaned/archived about 7TB of artifacts using this plugin.
Good part of this plugin IMHO, is that it runs inside Artifactory, therefor it can use the internal cron functionality of Artifactory. Also, the artifacts I'm working with are sized between a few KB till 5GB each, and running the plugin didn't have any impact on memory usage, CPU spiked sometimes, but our 500+ users don't notice anything, performance wise, of the archiving.

I'd very much appreciate this rule based approach!

We are going to move the project to open source in the next 2 weeks

We created artifactory-cleanup project.
You can try to use.
To do this you need install package and follow instration:
python3 -mpip install git+https://github.com/devopshq/artifactory-cleanup.git.
We'll add pypi later.

MANY THANKS @nikolasj

Fixed, thank you all!