JFrog CLI Working Files From Both Ends

Since JFrog CLI was introduced about a year ago, its popularity has skyrocketed in the CI community. When we asked our users what they liked most about JFrog CLI, the message we got back was clear:

Simple, Native, Efficient.

Simple: It’s simple and intuitive to use, and onboarding only takes a few minutes.

Native: It’s packaged as a native executable, so there is no dependence on any other tool (Java, Ruby, Node, etc.) to run it.

Efficient: It’s extremely efficient at the network level and is optimized to work with JFrog products supporting checksum uploads, range downloads, parallel execution, optimized AQL queries and more.

However, there was also a feature request that kept coming up and we have included it in the latest release of JFrog CLI v1.5.

File Specs

JFrog CLI is great for manipulating files. Uploading all ZIP files from a location in your file system to a repository in Artifactory is done with one simple command using a wildcard:

> jfrog rt u "/my-local-path/*.zip" my-repo/path

And you could, of course, use placeholders to make your target path dynamic or use a regular expression or properties to assemble different collections of files. But however smart you got about moving your files, you could only accomplish one basic task at a time. Users were telling us that they would like to do several tasks with one basic command such as moving one set of files to one repository and a different set of files to another repository. Now you can accomplish any number of tasks with one basic command using File Specs.

A File Spec is a JSON file that specifies the command line options and arguments for a JFrog CLI command. There is a schema for download, copy and move commands, another one for the upload command, and a third schema for search and delete commands.

Multiple File Sets

Suppose you’d like to download three sets of files from Artifactory. Each set of files has different characteristics, and therefore needs to be downloaded to a different location. For example, download zip files into a directory named “zip”, tar.gz file into a directory named “tgz” and so on. You could work around that without using File Specs, by running the CLI multiple times, but then you would lose the advantage of parallel execution since the CLI process stops after every execution.  This becomes important when you’re handing a large number of files and you want to make sure your download, upload, copy, move, search or delete operations are as optimized as they can be.
The big advantage of file specs is that now, you can define any number of specs for the same command to work on different sets of files. To accomplish the download described in the previous example, you could use the following file spec:

    "files": [
           "pattern" : "my-repo/*.zip", 
           "target": "files/zip/" 
           "pattern" : "my-repo/*.tar.gz", 
           "target": "files/tar.gz/" 
           "pattern" : "my-repo/*.gzip", 
           "target": "files/gzip/" 

Version Control

Another handy by-product of file specs is that since your specifications are now simple text files, they can be stored and versioned using your neighborhood source control system.

AQL for All

Lastly, file specs take flexibility to the max letting you specify the files you want to manipulate using Artifactory Query Language (AQL). For example, suppose you’d like to move all files that are related to a specific range of builds, or combine complex search criteria to get exactly what you need. These are the kind of file sets that only AQL can handle.

So, as simple as JFrog CLI already is, it just got simpler and more powerful, but that’s not all. JFrog CLI can now provide you with build information. Read how to get fully traceable builds no matter what build tool you are using.

Ready to give it a try? Download JFrog CLI.