jfrog-cli-retention-plugin

command module
v0.0.0-...-5e9c1f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

README

Note

This repository has moved to verifa/rt-retention

rt-retention

A JFrog CLI plugin to facilitate artifact retention in Artifactory.

TL;DR

Deletes artifacts matching all File Specs found in a given directory.

Allows for generation of FileSpecs files through Go templates and a JSON configuration file.

Installation

This plugin isn't currently hosted anywhere yet, so you'll be building it locally.

You can use the build.sh and install.sh scripts.

Usage

Commands
  • run

    • Usage: jf rt-retention run [command options] <filespecs-path>

    • Arguments:

      • filespecs-path (Path to the filespecs file/dir)
    • Options:

      • --dry-run disable communication with Artifactory [Default: true]
      • --verbose output verbose logging [Default: false]
      • --recursive recursively find filespecs files in the given dir [Default: false]
  • expand

    • Usage: jf rt-retention expand [command options] <config-path> <templates-path> <output-path>

    • Arguments:

      • config-path (Path to the JSON config file)
      • templates-path (Path to the templates dir)
      • output-path (Path to output the generated filespecs)
    • Options:

      • --verbose output verbose logging [Default: false]
      • --recursive recursively find templates in the given dir [Default: false]

Templating

This plugins allows you to generate retention policies using Go templates and a JSON config file.

Templates

Templates use values from the JSON config file to generate FileSpec files.

delete-older-than.json:

{
    "files": [{
        "aql": {
            "items.find": {
                "repo": "{{.Repo}}",
                "created" : {"$before" : "{{.Time}}"}
            }
        }
    }]
}
JSON config

The JSON config file contains a key for each template, with an array of entries for that template. Each entry will result in a FileSpecs file being generated.

If the entry has a Name property, it's value will be used as the FileSpecs file name.

config.json:

{
    "delete-everything": [
        { "Name": "foo-dev", "Repo": "foo-dev-local" },
        { "Name": "bar-dev", "Repo": "bar-dev-local" }
    ],
    "delete-older-than": [
        { "Name": "baz-dev", "Repo": "baz-dev-local", "Time": "30d" }
    ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL