Skip to main content

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

Release files for lavatory 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lavatory 1.2.2
File Interpreter ABI Platform
lavatory-1.2.2-py3-none-any.whl Python 3 none any Details

Release files / lavatory-1.2.2-py3-none-any.whl

Download URL lavatory-1.2.2-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b5b462a73ffb8e80ed0bc7d44584f77b5cc556afed13950b9a2605b1ab3740e
BLAKE2b-256 checksum
How to use checksums
face8b0b091bffd4effab075b102f83313b39465f09b55cf287b00c85f0dd9b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

1.2.2 This release

1 release file

1.2.1

1 release file

1.2.0

2 release files

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page