How to use JFrog CLI to Create, Update, Distribute & Delete Release Bundles
This blog post will provide you with information on how to use JFrog CLI with JFrog Distribution workflows. JFrog Distribution manages your software releases in a centralized platform. It enables you to securely distribute release bundles to multiple remote locations and update them as new release versions are produced. Learn more about JFrog Distribution >
For those of you who are not yet familiar with the JFrog CLI, it is an easy to use client that simplifies working with JFrog solutions using a simple interface. Learn more about JFrog CLI >
From version 1.35.1, JFrog CLI supports Distribution 2.x commands. Full list of commands >
Note: Requires JFrog Distribution version 2.0 or higher.
Configuration
Start by downloading and installing JFrog CLI.
The JFrog Platform uses the Artifactory (rt) domain for operating Release Bundles and distribution flow. Hence, all CLI commands should start with an rt prefix:
jfrog rt release-bundle-<command> <params>
Creating a Release Bundle
An unsigned Release Bundle Version allows updating its content before making it final for distribution.
The minimal set of arguments to create release bundle include:
- Release Bundle Name (30 chars max)
- Release Bundle Version (30 chars max)
Release Bundle Files Spec: Path to a file spec, which describes what artifacts to include in Release Bundle Version. Learn more about JFrog CLI File Spec >
jfrog rt rbc --spec=/Users/john/RB-spec.json myApp 1.0.0
Example of a Spec File – all files in myAppRepo:
{
"files": [
{
"pattern": "/myAppRepo/"
}
]
}
When creating the Release Bundle Version, it is also possible to finalize it by signing it using a pre-configured GPG key:
jfrog rt rbc --spec=/Users/john/RB-spec.json --sign=”true” myApp 1.0.0
Or
jfrog rt rbc --spec=/Users/john/RB-spec.json --sign myApp 1.0.0
Note: Once the Release Bundle Version is signed, it is not possible to make any changes.
Updating a Release Bundle
To update an unsigned Release Bundle Version, it is possible to use the release-bundle-update command. The parameters are the same as for release-bundle-create, but it will work only on existing versions of the Release Bundle.
jfrog rt rbu --spec=/Users/john/RB-spec.json myApp 1.0.0
Signing a Release Bundle
Signing a Release Bundle finalizes the process of creating a Release Bundle. This sets the Release Bundle status to Signed and the Release Bundle can no longer be edited. If the GPG key was created with a passphrase, please provide it as part of the command:
jfrog rt rbs --passphrase="<passphrase>" myApp 1.0.0
Note: The passphrase is optional. Provide GPG key passphrase if you generated the GPG signing keys with a passphrase.
Distributing a release bundle
Once you have created your Release Bundle, you can distribute it to the Artifactory Edge Nodes that you are privileged to distribute to using release-bundle-distribute command. The distribution will happen according to the distribution rules that are provided in rules file (json format):
jfrog rt rbd --dist-rules=/Users/john/distribute-rules.json myApp 1.0.0
Example of distribution rules – distribute to all Edge nodes:
{
"dry_run": false,
"distribution_rules": [
{
"site_name": "*",
"city_name": "*",
"country_codes": ["*"]
}
]
}
Deleting a release bundle
Using the release-bundle-delete command, it is possible to delete a Release Bundle Version from an Edge Nodes and optionally from JFrog Distribution itself.
To delete Release Bundle Version from Edge Nodes:
jfrog rt rbdel --dist-rules=/Users/john/distribute-rules.json myApp 1.0.0
To avoid the confirmation message by adding –quiet to the command:
jfrog rt rbdel --quiet --dist-rules=/Users/john/distribute-rules.json myApp 1.0.0
In order to delete the Release Bundle Version from the JFrog Distribution itself, add –delete-from-dist parameter:
jfrog rt rbdel --quiet --dist-rules=/Users/john/distribute-rules.json --delete-from-dist myApp 1.0.0
You can also delete the Release Bundle Version from JFrog Distribution only, leaving distributed copies on the Edge nodes (however this is not a recommended scenario):
jfrog rt rbdel --quiet --delete-from-dist myApp 1.0.0
TroubleShooting
In order to get more info and verbose messages in command-line, please set the log level to debug as follows:
export JFROG_CLI_LOG_LEVEL=DEBUG
Get started with JFrog CLI and try it out for yourself!