HTTPS SSH

Bitbucket Pipelines Pipe: Artifactory Generic Download

This pipe downloads an artifact from an JFrog Artifactory repository.

By default, this pipe will also capture build-info published to Artifactory as metadata associated with the downloaded file.

YAML Definition

Add the following snippet to the script section of your bitbucket-pipelines.yml file:

- pipe: JfrogDev/artifactory-generic-download:0.3.2
  variables:
    ARTIFACTORY_URL: '<string>'
    ARTIFACTORY_USER: '<string>'
    ARTIFACTORY_PASSWORD: '<string>'
    FILE_SPEC: "false"
    SOURCE_PATH: '<string>'
    TARGET_PATH: '<string>'
    # BUILD_NAME: '<string>' # Optional.
    # JFROG_CLI_TEMP_DIR: '<string>' # Optional.
    # JFROG_CLI_HOME_DIR: '<string>' # Optional.
    # COLLECT_ENV: '<boolean>' # Optional.
    # COLLECT_GIT_INFO: '<boolean>' # Optional.
    # COLLECT_BUILD_INFO: '<boolean>' # Optional.
    # FILE_SPEC_PATH: '<string>' # Optional.
    # FOLDER: '<string>' # Optional.
    # EXTRA_ARGS: '<string>' # Optional.
    # EXTRA_BAG_ARGS: '<string>' # Optional.
    # DEBUG: '<boolean>' # Optional.

Variables

Variable Usage
ARTIFACTORY_URL (*) The JFrog Artifactory URL .
ARTIFACTORY_USER (*) Artifactory User with permission to upload artifacts.
ARTIFACTORY_PASSWORD (*) Password for Artifactory User.
SOURCE_PATH (*) Specifies the source path of the Artifactory repository where the requested artifact is stored, in the following format: [repository name]/[repository path]. You can use wildcards to specify multiple artifacts.
TARGET_PATH (*) An optional argument to specify the local file system target path for the downloaded artifact.
FILE_SPEC (*) Set to true to use file spec to download artifacts. Default: false.
FILE_SPEC_PATH (*) Specifes the local file system path to a file spec. For more details, please refer to Using File Specs.
BUILD_NAME Build Name. Default: $BITBUCKET_REPO_OWNER-$BITBUCKET_REPO_SLUG-$BITBUCKET_BRANCH
JFROG_CLI_TEMP_DIR Defines the JFrog CLI temp directory. Default: .
JFROG_CLI_HOME_DIR Defines the JFrog CLI home directory.Default: .
COLLECT_ENV This flag is used to collect environment variables and attach them to a build. Default: true
COLLECT_GIT_INFO This flag is used to collects the Git revision and URL from the local .git directory and adds it to the build-info. Default: true
COLLECT_BUILD_INFO This flag is used to publish build info to Artifactory. Default: true
FOLDER A folder containing the package.json file. Default to the current directory: .
EXTRA_ARGS Extra arguments to be passed to the JFrog CLI command (see JFrog CLI docs for more details). Defaults to unset.
EXTRA_BAG_ARGS Extra arguments to be passed to the build-add-git (bag) JFrog CLI command (see JFrog CLI docs for more details). Defaults to unset.
DEBUG Set to true to output additional debug information. Default: false.

(*) = required variable.

Details

This pipe is used to download files from Artifactory.

Prerequisites

JFrog Artifactory details are necessary to use this pipe.

Examples

Basic example

Download artifact(s) from Artifactory Repository.

Following example is used downloads all artifacts with .zip extension from generic-local repository to ./generic directory in current worksapce.

script:
  - pipe: JfrogDev/artifactory-generic-download:0.3.2
    variables:
      ARTIFACTORY_URL: '<string>'
      ARTIFACTORY_USER: ${ARTIFACTORY_USER}
      ARTIFACTORY_PASSWORD: ${ARTIFACTORY_PASSWORD}
      FILE_SPEC: 'false'
      SOURCE_PATH: 'generic-local/*.zip'
      TARGET_PATH: './generic'

Advanced example

Download artifacts from Artifactory Repository using file spec provided in $FILE_SPEC_PATH along with custom properties.

script:
  - pipe: JfrogDev/artifactory-generic-download:0.3.2
    variables:
      ARTIFACTORY_URL: '<string>'
      ARTIFACTORY_USER: ${ARTIFACTORY_USER}
      ARTIFACTORY_PASSWORD: ${ARTIFACTORY_PASSWORD}
      FILE_SPEC: 'true'
      FILE_SPEC_PATH: "./spec.json"

spec.json file example:

{
  "files": [
    {
      "pattern": "$ART_REPO_NAME/*.zip",
      "target": "./"
    }
  ]
}

Support

If you'd like help with this pipe, or you have an issue or feature request, let us know on.

If you're reporting an issue, please include:

  • the version of the pipe
  • relevant logs and error messages
  • steps to reproduce

License

Apache 2.0 licensed, see LICENSE file.