Giter Site home page Giter Site logo

shdror / artifactory-du Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devopshq/artifactory-du

0.0 0.0 0.0 49 KB

JFrog Artifactory Disk Usage command line utility - View the size of each directory in artifactory as text

Home Page: https://devopshq.github.io/artifactory-du/

License: MIT License

Python 98.41% Dockerfile 0.82% Makefile 0.77%

artifactory-du's Introduction

Artifactory Disk Usage cli (artifactory-du)

docs dohq build status dohq on PyPI artifactory-du license

artifactory-du - estimate file space usage

Summarize disk usage in JFrog Artifactory of the set of FILEs, recursively for directories.

Table of Contents

Installation

The easiest way is using docker!

docker pull devopshq/artifactory-du
docker run devopshq/artifactory-du --version
# Install from PyPi
# python -mpip install artifactory-du

# From git
python -mpip install git+https://github.com/devopshq/artifactory-du.git

# and try to get help
artifactory-du --help

Usage

artifactory-du is used in the same manner as original du from *nix, although launch options are different. See artifactory-du --help for details.

# Recursive summary for root folder in repo.snapshot
artifactory-du --username username --password password --artifactory-url https://repo.example.ru/artifactory --repository repo.snapshot -h -s *

# Set alias for linux
alias adu=artifactory-du --username username --password password --artifactory-url https://repo.example.ru/artifactory --repository repo.snapshot -h
# usage
adu --max-depth=2 /*

# Set alias for Windows
set "adu=artifactory-du --username username --password password --artifactory-url https://repo.example.ru/artifactory --repository repo.snapshot -h"
# usage
%adu% --max-depth=2 /*

Below we skip artifactory-specific options: username, password, artifactory-url, repository, because we use ALIAS (for linux-bash or windows-cmd

# Summary for subfolder in folder
adu --max-depth=2 folder/*

# show 2 folder level inside repository
adu --max-depth=2 *

# Show only directory with GB size
adu --max-depth=0 * | grep G

# Show artifacts that have never been downloaded
adu --max-depth=0 * --without-downloads | grep G

# Show artifacts older than 30 days
adu --max-depth=0 * --older-than 30 | grep G

Artifactory options

Connection

  • --artifactory-url http://arti.example.com/artifactory -URL to artifactory, e.g: https://arti.example.com/artifactory"
  • --username USERNAME - user which has READ access to repository
  • --password PASSWORD, - user's password which has READ access to repository
  • --repository REPOSITORY - Specify repository
  • --verbose - increase output verbosity

Specific

  • --without-downloads - Find items that have never been downloaded (stat.downloads == 0)
  • --older-than DAY_COUNT - only counts size for files older than DAY_COUNT

DU options

  • --max-depth N - print the total size for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as --summarize
  • --human-readable, -h - print sizes in human readable format (e.g., 1K 234M 2G)
  • --all - write counts for all files, not just directories
  • --summarize - display only a total for each argument

Known issues

  1. Does not support filename in <file>: artifactory-du -h -s */*.deb will fail
  2. Does not print folder if summarize folder: artifactory-du -h -s foldername will out: 123G / , expected as original du: 123G foldername

CONTRIBUTING

How to contribute to the project:

  • Create your own github-fork
  • Change files
  • Create a pull request to the develop-branch

How to create a release:

AD

Have a look at artifactory-cleanup.

It's Artifactory's 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),
     ]},
]

Inspired by https://github.com/reversefold/artifactory-disk-usage

artifactory-du's People

Contributors

allburov avatar beliaev-maksim avatar rpetti avatar tjm avatar tttech-schueller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.