HTTPS SSH

Bitbucket Pipelines Pipe: Artifactory Build Promotion

This pipe promotes a build within JFrog Artifactory to a specified repository.

Promoting a build copies (or moves) the built artifacts to another Artifactory repository to make them available for the next set of consumers in the software delivery pipeline.

YAML Definition

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

- pipe: JfrogDev/artifactory-build-promotion:0.3.2
  variables:
    ARTIFACTORY_URL: '<string>'
    ARTIFACTORY_USER: '<string>'
    ARTIFACTORY_PASSWORD: '<string>'
    TARGET_REPO: '<string>'
    STATUS: '<string>'
    # BUILD_NAME: '<string>' # Optional.
    # JFROG_CLI_TEMP_DIR: '<string>' # Optional.
    # JFROG_CLI_HOME_DIR: '<string>' # Optional.
    # COPY: '<boolean>' # Optional.
    # FOLDER: '<string>' # Optional.
    # EXTRA_ARGS: '<string>' # Optional.
    # DEBUG: '<boolean>' # Optional.

Variables

Variable Usage
ARTIFACTORY_URL (*) The JFrog Artifactory URL .
ARTIFACTORY_USER (*) Artifactory User which has permission to deploy artifacts.
ARTIFACTORY_PASSWORD (*) Password for Artifactory User.
TARGET_REPO (*) Artifactory repository to receive the promoted build's artifacts.
STATUS (*) Status message to set during promotion.
BUILD_NAME Build Name. Default: $BITBUCKET_REPO_OWNER-$BITBUCKET_REPO_SLUG-$BITBUCKET_BRANCH
JFROG_CLI_TEMP_DIR Specifies the JFrog CLI temp directory. Default: .
JFROG_CLI_HOME_DIR Specifies the JFrog CLI home directory.Default: .
COPY Set to true to copy (or false to move) artifacts to the target Artifactory repository . 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.
DEBUG Set to true to output additional debug information. Default: false.

(*) = required variable.

Details

This pipe is used to promote build in Artifactory.

Prerequisites

JFrog Artifactory details are necessary to use this pipe. - Add the Credentials as a secured environment variable in Bitbucket Pipelines.

Examples

Basic example

Promote Build with Copying artifacts to Target Artifactory Repository.

script:
  - pipe: JfrogDev/artifactory-build-promotion:0.3.2
    variables:
      ARTIFACTORY_URL: '<string>'
      ARTIFACTORY_USER: ${ARTIFACTORY_USER}
      ARTIFACTORY_PASSWORD: ${ARTIFACTORY_PASSWORD}
      TARGET_REPO: 'npm-stage-local'
      STATUS: 'Staged'

Advanced example

script:
  - pipe: JfrogDev/artifactory-build-promotion:0.3.2
    variables:
      ARTIFACTORY_URL: '<string>'
      ARTIFACTORY_USER: ${ARTIFACTORY_USER}
      ARTIFACTORY_PASSWORD: ${ARTIFACTORY_PASSWORD}
      TARGET_REPO: 'npm-stage-local'
      STATUS: 'Staged'
      COPY: 'false'
  • Complete Example of building, testing, publishing, scanning and promoting npm package to Artifactory using JFrog Pipes.
pipelines:
  default:
    - step:
        services:
          - docker
        name: "npm-pipe-example"
        script:
          # Install NPM package dependencies from Artifactory
          - pipe: JfrogDev/artifactory-npm:0.2.3
            variables:
              ARTIFACTORY_URL: $ARTIFACTORY_URL
              ARTIFACTORY_USER: $ARTIFACTORY_USER
              ARTIFACTORY_PASSWORD: $ARTIFACTORY_PASSWORD
              NPM_COMMAND: "install"
              NPM_SOURCE_REPO: "npm"
              BUILD_NAME: "npm-pipe-example"
              COLLECT_BUILD_INFO: "false"
              COLLECT_GIT_INFO: "false"
          # Run Tests
          - npm test
          # Publish NPM package to Artifactory
          - pipe: JfrogDev/artifactory-npm:0.2.3
            variables:
              ARTIFACTORY_URL: $ARTIFACTORY_URL
              ARTIFACTORY_USER: $ARTIFACTORY_USER
              ARTIFACTORY_PASSWORD: $ARTIFACTORY_PASSWORD
              NPM_COMMAND: "publish"
              NPM_TARGET_REPO: "npm-local"
              BUILD_NAME: "npm-pipe-example"
          # Scan published build through Xray
          - pipe: JfrogDev/artifactory-xray-scan:0.2.7
            variables:
              ARTIFACTORY_URL: $ARTIFACTORY_URL
              ARTIFACTORY_USER: $ARTIFACTORY_USER
              ARTIFACTORY_PASSWORD: $ARTIFACTORY_PASSWORD
              BUILD_NAME: "npm-pipe-example"
          # Promote Build in Artifactory
          - pipe: JfrogDev/artifactory-build-promotion:0.3.2
            variables:
              ARTIFACTORY_URL: $ARTIFACTORY_URL
              ARTIFACTORY_USER: $ARTIFACTORY_USER
              ARTIFACTORY_PASSWORD: $ARTIFACTORY_PASSWORD
              TARGET_REPO: "npm-stage-local"
              STATUS: "Staged"
              BUILD_NAME: "npm-pipe-example"
          # Promote Build in Artifactory
          - pipe: JfrogDev/artifactory-build-promotion:0.3.2
            variables:
              ARTIFACTORY_URL: $ARTIFACTORY_URL
              ARTIFACTORY_USER: $ARTIFACTORY_USER
              ARTIFACTORY_PASSWORD: $ARTIFACTORY_PASSWORD
              TARGET_REPO: "npm-prod-local"
              STATUS: "Promoted"
              BUILD_NAME: "npm-pipe-example"

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.