Code Monkey home page Code Monkey logo

lavatory's Introduction

Build Status Documentation Status PyPi Badge

Lavatory

Tooling to define repository specific retention policies in Artifactory. Allows highly customizable retention policies via Python plugins.

See Lavatory Documentation for the full docs.

Requirements

  • Python 3.5+
  • Artifactory user with API permissions

Authentication

This tool looks for 3 enviroment variables in order to authenticate:

ARTIFACTORY_URL - Base URL to use for Artifactory connections

ARTIFACTORY_USERNAME - Username to Artifactory

ARTIFACTORY_PASSWORD - Password for Artifactory

These will be loaded in at the beginning of a run and raise an exception if missing.

Installing

From pypi:

pip install lavatory

Or install directly from the code:

git clone https://github.com/gogoair/lavatory
cd lavatory
pip install -U .

Running

$ lavatory --help
Usage: lavatory [OPTIONS] COMMAND [ARGS]...

  Lavatory is a tool for managing Artifactory Retention Policies.

Options:
  -v, --verbose  Increases logging level.
  --help         Show this message and exit.

Commands:
  purge  Deletes artifacts based on retention policies.
  stats    Get statistics of a repo.
  version  Print version information.

Purging Artifacts

lavatory purge --policies-path=/path/to/policies

$ lavatory purge --help
Usage: lavatory purge [OPTIONS]

  Deletes artifacts based on retention policies.

Options:
  --policies-path TEXT            Path to extra policies directory.
  --dryrun / --nodryrun           Dryrun does not delete any artifacts.
                                  [default: True]
  --default / --no-default        Applies default retention policy.  [default:
                                  True]
  --repo TEXT                     Name of specific repository to run against.
                                  Can use --repo multiple times. If not
                                  provided, uses all repos.
  --repo-type [local|virtual|cache|any]
                                  The types of repositories to search for.
                                  [default: local]
  --help                          Show this message and exit.

If you want to run Lavatory against a specific repository, you can use --repo <repo_name>. You can specify --repo as multiple times to run against multiple repos. If --repo is not provided, Lavatory will run against all repos in Artifactory.

Getting Statistics

lavatory stats --repo test-local

$ lavatory stats --help
Usage: lavatory stats [OPTIONS]

  Get statistics of a repo.

Options:
  --repo TEXT               Name of specific repository to run against. Can
                            use --repo multiple times. If not provided, uses
                            all repos.
  --help       Show this message and exit.

Policies

See the Creating Retention Policies docs for more details on how to create and use retention policies with Lavatory.

Listing Policies

Lavatory looks at a policy functions docstring in order to get a description. You can list all repos and a description of the policy that would apply to them with the lavatory policies command.

$ lavatory policies --help
Usage: lavatory policies [OPTIONS]

  Prints out a JSON list of all repos and policy descriptions.

Options:
  --policies-path TEXT            Path to extra policies directory.
  --repo TEXT                     Name of specific repository to run against.
                                  Can use --repo multiple times. If not
                                  provided, uses all repos.
  --repo-type [local|virtual|cache|any]
                                  The types of repositories to search for.
                                  [default: local]
  --help                          Show this message and exit.

Testing

pip install -r requirements-dev.txt
tox

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.