Use File Specs in your CI/CD To Get Full Control of Your Artifacts

Getting creative with how you manage your artifacts in JFrog Artifactory? It’s time to get familiar with File Specs.

File specs allow you to specify the files you want to upload and download to and from Artifactory with a simple configuration. With only 2 mandatory fields, source (referred to as pattern) and target, you can find the artifacts you need according to the specifications that you define. Advanced users can also benefit from the power of regex and AQL to define file source patterns and targets when uploading and downloading artifacts. You can also use placeholders to determine the name of the artifact once downloaded or uploaded. The possibilities are endless.

What’s even better is that you can actually define a single File Spec that can be used with your favorite CI server, including Jenkins, TeamCity and Bamboo. You can even use file specs with cloud CI servers, such as Travis-CI and Circle CI, using JFrog CLI!

Let’s get started with some interesting examples that implement these functionalities.


File specs are supported for both generic and pipeline Jenkins jobs using the Jenkins Artifactory plugin. Below is an example script showing how to upload a file to Artifactory in a Jenkins pipeline job.

Notice the regex defined in the pattern field below specifies to upload all files from the “jenkins-pipeline-examples/resources/” directory that match the “.*A[A-z]tifactory.*.zip” or “.*(A|a)rtifactory.*.zip” patterns.

For example: “” and “”.

def uploadSpec = """{
    "files": [
          "pattern": "jenkins-pipeline-examples/resources/.*A[A-z]tifactory.*.zip",
          "target": "libs-snapshot-local/",
          "regexp": "true"
          "pattern": "jenkins-pipeline-examples/resources/.*(A|a)rtifactory.*.zip",
          "target": "libs-snapshot-local/",
         "regexp": "true"
server.upload spec: uploadSpec, buildInfo: buildInfo

In generic jobs, there are two ways to define your file spec: load the spec from a file, or save it as text in your job configuration.

Defining file spec in a file

To specify a JSON file as the file spec source simply add the path to the file, relative to the workspace. In the example below, “props-download.json” will be used.

Download Spec Source Jenkins Example

Defining file spec in the job configuration

Download Spec Source File Jenkins Example


The TeamCity Artifactory plugin also allows you to specify download and upload spec sources in generic run types. Just as in Jenkins, you can also choose between ‘File’ and ‘Job configuration’. Generic run types that can be used include Command line, Powershell, MSbuild and more.

TeamCity Artifactory Plugin


There are 2 separate generic jobs, deploy and resolve, that are used to upload and download files from Artifactory using the Bamboo Artifactory plugin. Just as in the previous CI servers, the option to choose either a file or job configuration as a spec source is also available here. Below are examples for each.

To upload files to Artifactory create an “Artifactory generic Deploy” task. Fill in the details and select the “Specs” option under “upload by”.

Bamboo Upload Example

To download files from Artifactory create an “Artifactory Generic Resolve” task, respectively.

Bamboo Download Example


The JFrog CLI supports file specs, with its download, upload, search, move, copy and delete commands. Simply create a JSON file with the spec and attach it to the command using the –spec option. For example:

  • jfrog rt u –spec /path/to/spec/upload_spec.json.
  • jfrog rt dl –spec /path/to/spec/download_spec.json.
  • jfrog rt mv –spec /path/to/spec/move_spec.json.
  • jfrog rt cp –spec /path/to/spec/copy_spec.json.
  • jfrog rt del –spec /path/to/spec/delete_spec.json.
  • jfrog rt s –spec /path/to/specs/search_spec.json.

Summarizing All This Greatness

Now it’s your turn to take advantage of this powerful File Spec feature, and benefit from a simple and universal way to manage your files. Start by trying it out with some of our examples, and then use it with all your favorite CI servers.