This module provides various tools for the supported repository manager JFrog, including downloading artifacts, deleting old artifacts and deleting a specified amount of PR build artifacts.
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.
o3r-artifact-cleaner [options]
The required options include:
--artifactory-url
)--basicAuth <basicAuth>
)--repositories <repositories>
)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 |
yarn o3r-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword
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.
o3r-pr-artifact-cleaner [options]
The required options include:
--artifactory-url <artifactoryUrl>
)--api-key <apiKey>
or --basicAuth <base64>
)--repository <repository>
)--path <path>
)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 |
yarn o3r-pr-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword
Downloads artifacts from Artifactory repositories.
o3r-artifact-downloader [options]
The required option is:
--url <url>
)Option | Alias | Value Type | Default Value | Description |
---|---|---|---|---|
--url <url> (Required) |
-u |
string |
Full URL of the artifact to download | |
--output-dir <outputDir> |
-o |
string |
. |
Output directory for the downloaded file |
--filename <filename> |
-f |
string |
Output filename (if not provided, will use the filename from URL) | |
--artifactory-user <user> |
string |
Artifactory username (can also be set via ARTIFACTORY_USER env var) |
||
--artifactory-password <password> |
string |
Artifactory password (can also be set via ARTIFACTORY_PASSWORD env var) |
||
--basic-auth <base64> |
-b |
string |
Base64 encoding of username:password (takes priority over --artifactory-user/--artifactory-password) | |
--verbose |
-v |
Display verbose output for debugging | ||
--help |
-h |
Output usage information |
The tool supports multiple authentication methods with the following priority:
--basic-auth
If authentication fails (401) and no credentials were provided, the tool will display helpful error messages.
Download from a public repository:
Example :o3r-artifact-downloader -u "https://repo.maven.apache.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar"
Download with username/password:
Example :o3r-artifact-downloader \
-u "https://my-artifactory.company.com/repository/releases/com/example/app/1.0.0/app-1.0.0.jar" \
--artifactory-user myuser \
--artifactory-password mypassword
Download using environment variables:
Example :export ARTIFACTORY_USER=myuser
export ARTIFACTORY_PASSWORD=mypassword
o3r-artifact-downloader -u "https://my-artifactory.company.com/repository/releases/com/example/app/1.0.0/app-1.0.0.jar"
Download with basic auth:
Example :o3r-artifact-downloader \
-u "https://my-artifactory.company.com/repository/releases/com/example/app/1.0.0/app-1.0.0.jar" \
-b "dXNlcm5hbWU6cGFzc3dvcmQ="
Download to specific directory with custom filename:
Example :o3r-artifact-downloader \
-u "https://my-artifactory.company.com/repository/releases/com/example/app/1.0.0/app-1.0.0.jar" \
-o "./downloads" \
-f "my-app.jar"