@o3r/artifactory-tools
v11.5.4
Published
Various artifactory tools
Downloads
29,707
Readme
Description
This module provides various tools for the supported repository manager JFrog, including deleting old artifacts and deleting a specified amount of PR build artifacts.
Artifact cleaner (JFrog)
Cleans old artifacts from JFrog artifactory repositories. Based on the provided (or default) milliseconds value, this script will delete artifacts created before the specified date and artifacts that have not been downloaded since the specified date. The search for the artifacts to delete is limited to the specified repositories.
Further information can be found in the JFrog documentation here.
Usage
o3r-artifact-cleaner [options]
The required options include:
- the JFrog artifactory URL (
--artifactory-url
) - the authentication (
--basicAuth <basicAuth>
) - the artifact repositories to clean up (
--repositories <repositories>
)
Options
| Option | Alias | Value Type | Default Value | Description |
|----------------------------------------------------------|:-----:|----------------------|---------------------------------|------------------------------------------------------------------------------------------------|
| --artifactory-url <artifactoryUrl>
(Required) | | string
| | JFrog artifactory URL |
| --basicAuth <basicAuth>
(Required) | -b
| string
| | Base64 encoding of username:password (password already encrypted from artifactory UI) |
| --repositories <repositories>
(Required) | -r
| string
| | Artifact repositories to clean up (comma separated) ex: 'repo1,repo2'
|
| --dry-run <dryRun>
| | boolean
| false
| List all files that would be deleted without actually deleting them |
| --duration-kept <durationKept>
| -d
| number
or string
| 604800000
(i.e., 7 days) | All artifacts older than this value (in ms) or not downloaded since this value will be deleted |
| --type-filter <typeFilter>
| -t
| string
| 'tgz,json'
| List of artifact types that should be deleted (comma separated) ex: 'jar,tgz'
|
| --help
| -h
| | | Output usage information |
Example
yarn o3r-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword
PR Artifact cleaner (JFrog)
Cleans old PR artifacts from JFrog by using the build version that is present in the path. If the build version is not present in the path, this tool cannot be used. Based on the provided (or default) days value, this script will delete artifacts created before the specified date, within the provided repository matching the provided path.
Further information can be found in the JFrog documentation here.
Usage
o3r-pr-artifact-cleaner [options]
The required options include:
- the JFrog artifactory URL (
--artifactory-url <artifactoryUrl>
) - a method of authentication (
--api-key <apiKey>
or--basicAuth <base64>
) - the artifact repository to clean up (
--repository <repository>
) - the artifact paths to clean up (
--path <path>
)
Options
| Option | Alias | Value Type | Default Value | Description |
|----------------------------------------------------------|:-----:|------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| --artifactory-url <artifactoryUrl>
(Required) | -u
| string
| | JFrog artifactory URL |
| --path <path>
(Required) | -p
| string
| | Artifact paths to clean up (using matcher from AQL language). Be careful not to include release artifacts in the path. ex: sample/path/*-PR-*
|
| --repository <repository>
(Required) | -r
| string
| | Artifact repository to clean up |
| --api-key <apiKey>
| -a
| string
| | Artifactory API key of the user that can be used to log in |
| --basicAuth <base64>
| -b
| string
| | Base64 encoding of username:password (password already encrypted from artifactory UI) |
| --dry-run <dryRun>
| | boolean
| false
| List all files that would be deleted without actually deleting them |
| --duration-kept <durationKept>
| -d
| number
| 1
| All artifacts older than this value (in days) will be deleted |
| --pr-builds <prBuilds>
| -n
| number
| 1
| Number of PR build artifacts that will be kept |
| --verbose
| -v
| | | Display the executed AQL query |
| --help
| -h
| | | Output usage information |
Example
yarn o3r-pr-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword