Pushing Artifacts to JFrog

You can push your artifacts to JFrog in any section of your yml. Typically, you would want to push your artifacts at the end of the ci section.

Setup

Before you start, you will need to connect your JFrog account with Shippable so we have the credentials to push artifacts on your behalf.

  • Please follow the steps outlined here to create an integration.

  • Use the integration name in the configuration below.

Basic Config

After completing the Setup step, add the following to the shippable.yml for your project. This snippet tells our service to authenticate with JFrog using your keys and pushes the artifacts in ci section.

build:
  ci:
    - jfrog rt u pages/artifact.tar target-dir/target-filename.tar

integrations:
  hub:
    - integrationName: jfrog-integration  #replace with your subscription integration name
      type: artifactory

Advanced config

Limiting branches

By default, your integration is valid for all branches. If you want to only push your artifacts for specific branch(es), you can do so with the branches keyword.

build:
  ci:
    - if [ "$BRANCH" == "master" ]; then jfrog rt u pages/artifact.tar target-dir/target-filename.tar; fi

integrations:
  hub:
    - integrationName: jfrog-integration  #replace with your subscription integration name
      type: artifactory
      branches:
        only:
          - master

In addition to the only tag which includes specific branches, you can also use the except tag to exclude specific branches.

Pushing to different accounts based on branch

You can also choose to push your images to different jfrog accounts, depending on branch.

build:
  ci:
    - if [ "$BRANCH" == "master" ]; then jfrog rt u pages/artifact.tar target-dir/target-filename.tar; fi

integrations:
  hub:
    - integrationName: jfrog-integration  #replace with your subscription integration name
      type: artifactory
      branches:
        only:
          - master

In addition to the only tag which includes specific release tags, you can also use the except tag to exclude specific release tags.

Pushing to different accounts based on release tags

You can also choose to push your images to different jfrog accounts, depending on the release tag. When a release is created, a tag is specified. The account that is chosen is the one that matches the tag name. Wild cards are supported. If a release is created without an existing tag, the tag version is used for matching.

To use release tags, please go to your project dashboard, click on Settings(gear icon) and enable Releases in WEBHOOK CONFIG section.

build:
  ci:
    - if [ "$BRANCH" == "master" ]; then jfrog rt u pages/artifact.tar target-dir/target-filename.tar; fi  

integrations:                               
  hub:
    - integrationName: jfrog-integration    #replace with your subscription integration name   
      type: artifactory    
      branches:
        only:
          - v1.* # production release tag

In addition to the only tag which includes specific release tags, you can also use the except tag to exclude specific release tags.

Sample project

Here are some links to a working sample of this scenario. This is a simple Node.js application that runs some tests and then pushes the artifacts to JFrog.

Source code: devops-recipes/ci-push-to-jfrog

Improve this page

We really appreciate your help in improving our documentation. If you find any problems with this page, please do not hesitate to reach out at support@shippable.com or open a support issue. You can also send us a pull request to the docs repository.