Using File Specs
Overview
To achieve complex file manipulations you may require several CLI commands. For example, you may need to upload several different sets of files to different repositories. To simplify the implementation of these complex manipulations, you can apply JFrog CLI download, upload, move, copy and delete commands with JFrog Artifactory using --spec option to replace the inline command arguments and options. Similarly, you can create and update release bundles by providing the --spec
command option. Each command uses an array of file specifications in JSON format with a corresponding schema as described in the sections below. Note that if any of these commands are issued using both inline options and the file specs, then the inline options override their counterparts specified in the file specs.
File Spec Schemas
Copy and Move Commands Spec Schema
The file spec schema for the copy and move commands is as follows:
Download Command Spec Schema
The file spec schema for the download command is as follows:
Create and Update Release Bundle V1 Commands Spec Schema
The file spec schema for the create and update release bundle v1 commands is as follows:
Upload Command Spec Schema
The file spec schema for the upload command is as follows:
Search, Set-Props and Delete Commands Spec Schema
The file spec schema for the search and delete commands are as follows:
Examples
The following examples can help you get started using File Specs.
Example 1
Download all files located under the all-my-frogs directory in the my-local-repo repository to the froggy directory.
Example 2
Download all files located under the all-my-frogs directory in the my-local-repo repository to the froggy directory. Download only files which are artifacts of build number 5 of build my-build .
Example 3
Download all files retrieved by the AQL query to the froggy directory.
Example 4
All zip files located under the resources directory to the zip folder, under the all-my-frogs repository. AND
All TGZ files located under the resources directory to the **tgz folder, under the all-my-frogs repository.
Tag all zip files with type = zip and status = ready.
Tag all tgz files with type = tgz and status = ready.
Example 5
Upload all zip files located under the resources directory to the zip folder, under the all-my-frogs repository.
Example 6
Package all files located (including subdirectories) under the resources directory into a zip archive named archive.zip , and upload it into the root of the all-my-frogs repository.
Example 7
Download all files located under the all-my-frogs directory in the my-local-repo repository except for files with .txt extension and all files inside the all-my-frogs directory with the props. prefix.`
Notice that the exclude patterns do not include the repository.
Example 8
Download The latest file uploaded to the all-my-frogs directory in the my-local-repo repository.
Example 9
Search for the three largest files located under the all-my-frogs directory in the my-local-repo repository. If there are files with the same size, sort them "internally" by creation date.
Example 10
Download The second-latest file uploaded to the all-my-frogs directory in the my-local-repo repository.
Example 11
The following File Spec finds all the folders which match the following criteria:
They are under the my-repo repository.
They are inside a folder with a name that matches abc-*-xyz and is located at the root of the repository.
Their name matches ver*
They were created more than 7 days ago.
Example 12
Example 13
Example 14
Example 15
This example creates a release bundle v1 and applies "pathMapping" to the artifact paths after distributing the release bundle v1.
All occurrences of the "a1.in" file are fetched and mapped to the "froggy" repository at the edges.
Fetch all artifacts retrieved by the AQL query.
Create the release bundle v1 with the artifacts and apply the path mappings at the edges after distribution.
The "pathMapping" option is provided, allowing users to control the destination of the release bundle artifacts at the edges.
Schema Validation
Using Jetbrains IDEs (Intellij IDEA, Webstorm, Goland, etc...)?
The File Spec schema is automatically applied to the following file patterns:
**/filespecs/*.json
*filespec*.json
*.filespec
Using Visual Studio Code?
Alternatively, copy the following to your settings.json file:
settings.json
Last updated