Upload and Download Files - Scripted Pipeline Syntax

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo
To upload or download files you first need to create a spec which is a JSON file that specifies which files should be uploaded or downloaded and the target path.
For example:
def downloadSpec = """{
 "files": [
  {
      "pattern": "bazinga-repo/*.zip",
      "target": "bazinga/"
    }
 ]
}"""
The above spec specifies that all ZIP files in thebazinga-repo Artifactory repository should be downloaded into thebazingadirectory on your Jenkins agent file system.

"files" is an array

Since the "files" element is an array, you can specify several patterns and corresponding targets in a single download spec.
To download the files, add the following line to your script:
server.download spec: downloadSpec 
Uploading files is very similar. The following example uploads all ZIP files that includefroggyin their names into thefroggy-filesfolder in thebazinga-repoArtifactory repository.
def uploadSpec = """{
  "files": [
    {
      "pattern": "bazinga/*froggy*.zip",
      "target": "bazinga-repo/froggy-files/"
    }
 ]
}"""
server.upload spec: uploadSpec 
You can read about using File Specs for downloading and uploading files here.
If you'd like the build to fail, in case no files are uploaded or downloaded, add the 
                              failNoOp
                            argume to the 
                              upload
                            or 
                              download
                            methods as follows:
server.download spec: downloadSpec, failNoOp: true
server.upload spec: uploadSpec, failNoOp: true