Note
This repository has moved to verifa/rt-retention
A JFrog CLI plugin to facilitate artifact retention in Artifactory.
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.
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.
-
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]
-
This plugins allows you to generate retention policies using Go templates and a JSON config file.
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}}"}
}
}
}]
}
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" }
]
}