Using Artifactory 5.x ?
JFrog Artifactory 5.x User Guide
Have a question? Want to report an issue? Contact JFrog support
{ "files": [ { "pattern" or "aql": "[Mandatory]", "target": "[Mandatory]", "props": "[Optional]", "recursive": "[Optional, Default: true]", "flat": "[Optional, Default: false]", "build": "[Optional]" } ] }
Where:
Element | Description |
---|---|
pattern | [Mandatory if 'aql' is not specified] |
target | [Mandatory] For flexibility in specifying the target path, you can include placeholders in the form of Since version 2.9.0 of the Jenkins Artifactory plugin and version 2.3.1 of the TeamCity Artifactory plugin the target format has been simplified and uses the same file separator "/" for all operating systems, including Windows. |
aql | [Mandatory if 'pattern' is not specified] |
props | [Optional] |
flat | [Default: false] |
recursive | [Default: true] |
build | [Optional] The property format is build-name/build-number. If the build number is not specified, or the keyword LATEST is used for the build number, then the latest published build number is used. |
Upload Spec Schema
{ "files": [ { "pattern": "[Mandatory]", "target": "[Mandatory]", "props": "[Optional]", "recursive": "[Optional, Default: 'true']", "flat" : "[Optional, Default: 'true']", "regexp": "[Optional, Default: 'false']" } ] }
Where:
Element | Description |
---|---|
pattern | [Mandatory] Specifies the local file system path to artifacts which should be uploaded to Artifactory. You can specify multiple artifacts by using wildcards or a regular expression as designated by the regexp property. Since version 2.9.0 of the Jenkins Artifactory plugin and version 2.3.1 of the TeamCity Artifactory plugin the pattern format has been simplified and uses the same file separator "/" for all operating systems, including Windows. |
target | [Mandatory] Specifies the target path in Artifactory in the following format: [repository_name]/[repository_path] If the pattern ends with a slash, for example "repo-name/a/b/", then "b" is assumed to be a folder in Artifactory and the files are uploaded into it. In the case of "repo-name/a/b", the uploaded file is renamed to "b" in Artifactory. For flexibility in specifying the upload path, you can include placeholders in the form of |
props | [Optional] |
flat | [Default: true] |
recursive | [Default: true] |
regexp | [Default: false] If true, the command will interpret the pattern property, which describes the local file-system path of artifacts to upload, as a regular expression. If false, the command will interpret the pattern property as a wild-card expression. |
Using Placeholders
File Specs offer enormous flexibility in how you upload, or download files through use of wildcard or regular expressions with placeholders.
Any wildcard enclosed in parenthesis in the pattern property can be matched with a corresponding placeholder in the target property to determine the name of the artifact once downloaded or uploaded. The following example downloads all zip files, located under the root path of the my-local-repo
repository, which include a dash in their name. The files are renamed when they are downloaded, replacing the dash with two dashes.
{ "files": [ { "pattern": "my-local-repo/(*)-(*).zip", "target": "froggy/{1}--{2}.zip", "recursive": "false" } ] }
Examples
Example 1: Download all files located under the all-my-frogs
directory in the my-local-repo
repository to the froggy/all-my-frogs
directory.
{ "files": [ { "pattern": "my-local-repo/all-my-frogs/", "target": "froggy/" } ] }
Example 2: Download all files retrieved by the AQL query to the froggy
directory.
{ "files": [ { "aql": { "items.find": { "repo": "my-local-repo", "$or": [ { "$and": [ { "path": { "$match": "." }, "name": { "$match": "a1.in" } } ] }, { "$and": [ { "path": { "$match": "*" }, "name": { "$match": "a1.in" } } ] } ] } }, "target": "cli-reg-test/spec-copy-test/aql-a1/" } ] }
Example 3: Upload
- All zip files located under the
resources
directory to thezip
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.
{ "files": [ { "pattern": "resources/*.zip", "target": "my-repo/zip/", "props": "type=zip;status=ready" }, { "pattern": "resources/*.tgz", "target": "my-repo/tgz/", "props": "type=tgz;status=ready" } ] ]