Have a question? Want to report an issue? Contact JFrog support

Skip to end of metadata
Go to start of metadata

Overview

Artifactory takes its integration with JFrog Bintray to the next step with Distribution Repositories. Distribution repositories provide an easy way to move artifacts from Artifactory to Bintray, for distribution to end users. As opposed to other repositories in Artifactory, distribution repositories are not typed to a particular package format, but rather, are governed by a set of rules that specify how an artifact that gets to the distribution repository should be routed to its corresponding repository in Bintray.

Configuring a Distribution Repository

You can access your distribution repositories in the Admin module under Repositories | Distribution. 

Distribution Repositories

Page Contents

To set up a new distribution repository, click New and execute the following main steps:

  1. Connect to Bintray - obtain authorization from your Bintray account for Artifactory to connect and deploy packages
  2. Configure distribution - specify basic distribution parameters
  3. Configure Advanced Settings - specify advanced settings
  4. Define rules - specifies the rules that govern how this distribution repository will deploy packages to Bintray

Connecting to Bintray

Artifacts are synchronized from your Artifactory distribution repository to Bintray through a Bintray organization to which you have administration privileges. To set up the connection, you first need authorize Artifactory to access your Bintray organization. Artifactory will display a popup dialog where you can enter your Bintray credentials.

Authorizing access to Bintray

Already logged into Bintray?

If you are already logged into your Bintray account, Artifactory will skip this step

After authorizing access to your account, you need to select the organization in that account that you authorize Artifactory to manage.

Authorize organization

Bintray will issue an authorization code which you need to copy, and then paste in your distribution repository configuration.

Authorization code

When you close the popup with the authorization code, Artifactory will display a popup for you to enter it.

Once the process is complete, you can verify that Artifactory has been authorized to access your Bintray organization, in that organization's profile page under OAuth Applications.

Bintray OAuth Applications

Basic Distribution Parameters

Once you have set up Artifactory as an authorized application in your Bintray organization, you can set up the distribution parameters

 

Repository KeyThe repository key.
General
 
DescriptionA description of the repository.
  
Bintray Product
 
Use This Repository To Distribute a ProductWhen set, indicates that artifacts distributed through this repository should be linked to a product. Artifactory will create the product (if necessary) and link deployed packages to the product.
Product NameThe product name.
  
Bintray Application
 
customer IDThe client ID assigned by Bintray to Artifactory as an authorized application.
OrganizationThe Bintray organization which Artifactory is authorized to manage for distribution.
  
Default Repository Settings
If Artifactory creates a new repository on Bintray for distribution, this setting specifies if the repository should be private or public. If the repository exists, Artifactory will not override its access regardless of this setting.
  
Default Package Settings
 
LicensesSpecifies the OSS licenses that should be attached to any packages distributed through this repository.
VCS URLSpecifies the VCS URL for packages distributed through this repository.

Advanced Settings

Proxy
Select a proxy to use when synchronizing artifacts to Bintray.
GPG Signing
When set, Artifactory will GPG sign artifacts synchronized to Bintray.
GPG Passphrase
The passphrase to use for GPG signing.
Map Properties to Bintray Attributes
Specify a list of properties which, if they annotate the artifact distributed, should be mapped to version attributes in Bintray.

Managing Rules

As opposed to local, remote and virtual repositories in Artifactory, distribution repositories are not limited to a specific package type. Instead, you specify a set of rules, based on package type, and different filters, that give you fine-grained control over how different packages are pushed to Bintray for distribution. To view the rules defined for your repository, click the Rules tab. New distribution repositories come with a pre-defined set of rules which you can modify, delete or add to as needed.

Distribution repository rules

Filtering and deleting

Start typing the name of a rule in the filter box to find the rule you are looking for.

Hover over a rule and click the delete icon on the right to delete it, or select a number of rules in the left column and click Delete to remove several rules at a time.

Rule Order

The order in which rules are displayed specifies the order in which they are applied. To change the rule order, you can select a rule and drag it to a new location in the list.

Conflicting rules

While it is possible to specify rules that conflict, since rules are applied in the order in which they appear, the first rule that is applied will take precedence.

Specifying Rule Parameters

To specify rule parameters, click New for a new rule, or the Name of a rule you want to edit.

 

NameA logical name for this rule
  
Artifactory Input
Parameters that determine which packages in Artifactory this rule applies to.
Package TypeSpecifies the artifact package type for which this rule should be applied. Artifacts of other package types are ignored
Available TokensAccording to the package type selected, this specifies which tokens can be used to specify the deployment path in Bintray
Repository FilterWildcard expression that specifies for which original source repositories this rule should be applied. Packages in other repositories are ignored.
Path FilterWildcard expression that specifies the artifact path for which this rule should be applied. Packages that have a different path are ignored.
  
Output Bintray
Parameters that determine how artifacts should be deployed to Bintray.
RepositoryThe Bintray repository to which artiafcts should be deployed.
PackageThe Bintray package in the specified Bintray repository to which the artifact should be deployed. If the package does not exist, it will be created
VersionThe Bintray version in the specified Bintray package and repository to which the artifact should be deployed. If the version does not exist, it will be created.
PathThe path in Bintray into which the artifact should be deployed in the specified repository.

Repository and Path Filter Parameters

Rules give you enormous flexibility in how you deploy artifacts to Bintray through use of regular expressions with capture groups where the capture groups may be named or unnamed.

Unnamed capture groups are back-referenced using placeholder tokens, while named capture groups are back-referenced using their names.

Using Unnamed Capture Groups

For each regular expression used in Repository Filter or Path Filter fields of the Artifactory Input section, you can place tokens in fields of the Bintray Output section to back-refrence them. 

Tokens are written using the following format:

${source:x}

where:

source

path: A wildcard from the Path Filter field should be replaced

repo: A wildcard from the Repository Filter field should be replaced

xThe wildcard number.

For example,

${path:1} means replace the first regular expression in the Path Filter field

${repo:2} means replace the second regular expression in the Repository Filter field

Example 1

Under Artifactory Input, set Path Filter = jfrog-(.*).rpm

Under Bintray Output, set Repository = rpm-${path:1}

With these settings, a package called jfrog-artifactory.rpm will be deployed to a repository in Bintray called rpm-artifactory, while a package called jfrog-mission-control.rpm will be deployed to a repository in Bintray called rpm-mission-control 

Example 2

Under Artifactory Input, Repository Filter = libs-(.*)

Under Bintray Output, Repository = rpm-${repo:1}

With these settings:

A package called jfrog-artifactory.rpm from libs-release-local will be deployed to a repository in Bintray called rpm-release-local.

A package called jfrog-artifactory.rpm from libs-snapshot-local, will be deployed to a repository in Bintray called rpm-snapshot-local.

Using Named Capture Groups

You can give capture groups in the Repository Filter or Path Filter fields of the Artifactory Input section specific names and then back-reference the capture group using its name in the fields of the Bintray Output section.

Named capture groups are written using the following format:

(?<name>regex)

where:

nameA logical name for the capture group
regexThe regular expression that defines repositories or paths that should pass through the filter

Once capture groups are defined, you can back-reference them in the fields of the Bintray Output section using the following format:

$(source:name)

where:

source

path: A capture group from the Path Filter field should be back-referenced

repo: A capture group from the Repository Filter field should be back-referenced

nameThe name of the capture group.
Example 1

If you set:

Under Artifactory Input, Repository Filter = (?<myRepo>-local)

Under Bintray Output, Repository= generic-$(repo:myRepo)

Then a package in repository builds-local will be deployed to a repository in Bintray called generic-builds.

Example 2

If you set:

Under Artifactory Input, Path Filter = jfrog-(?<myPath>.*).rpm

Under Bintray Output, Repository= rpm-$(path:myPath)

Then a package called jfrog-artifactory.rpm in repository libs-release-local will be deployed to a repository in Bintray called rpm-artifactory, while a package called jfrog-mission-control.rpm will be deployed to a repository in Bintray called rpm-mission-control.

Enumerating Capture Groups

You can use multiple capture groups when specifying rule parameters, and they are enumerated in the order in which they are received .

For example, if you set:

Under Artifactory Input, Path Filter = jfrog-(.*).(.*)

Under Bintray Output, Repository = ${path:2}-${path:1}

Then:

jfrog-artifactory.rpm will be deployed to a repository in Bintray called rpm-artifactory
jfrog-artifactory.zip will be deployed to a repository in Bintray called zip-artifactory
jfrog-mission-control.rpm will be deployed to a repository in Bintray called rpm-mission-control
jfrog-mission-control.zip will be deployed to a repository in Bintray called zip-mission-control

You can even mix both named and unnamed capture groups together when specifying rule parameters, however, they are still enumerated in the order in which they are received.

Expanding the example above, if you set:

Under Artifactory Input, Path Filter = jfrog-(?<type>.*).(.*)

Under Bintray Output, Repository = ${path:2}-${path:type}

"type" is enumerated as the first capture group, and it is back-referenced using its name.

The unnamed capture group is unnamed and second in the enumeration order, so it is back-referenced using its number, 2.


Distributing Artifacts

Once you have your distribution repositories configured, the last step in getting your files to Bintray is to invoke distribution. When you invoke distribution, Artifactory goes through the rules defined for your distribution repository in order until the artifact you are trying to distribute passes one of them, and then uploads the file to Bintray in accordance with that rule. Once distributed, the file will also appear in your distribution repository to indicate that it has been uploaded to Bintray.

There are two ways to do this:

  1. Distributing through the UI
  2. Distributing via REST API

Distributing Through the UI

To distribute a file through the UI, select it in the Artifact Repository Browser and click Distribute in the right-click menu.

Distribute via the UI

Artifactory will pop up the Distribution dialog where you can set final parameters for distribution.

Distribution dialog

Distribution Repository
The distribution repository through which the artifact should be uploaded to Bintray. The rules defined for this repository will govern if/how the file is uploaded.
Distribute Artifacts Asynchronously

When checked, the file will be uploaded asynchronously. To verify upload to Bintray succeeded, refresh your distribution repository to see the distributed file.

When unchecked, if upload to Bintray fails, Artifactory will display an error message.

If upload to Bintray fails, please refer to the Artifactory System Log for details.

Publish Distributed Artifacts
When checked, files uploaded to Bintray are published to make them available for download by end users
Override Existing Files
When checked, the uploaded file will override another file with the same name if it exists in the upload path.

Once distribution is complete, Artifactory displays the outcome of the process in a Success section and an Error section.

The Success section displays the repository, package and version in which the distributed artifacts will be hosted in Bintray. If the distribution process created a package or version, this will also be indicated in the Success section. In the example below, both a package and a version were created.

Success section

If an error occurs in moving distributed files to Bintray, the Distribution dialog will also display an Errors section. In the example below, the success section shows that there was an attempt to upload files to version 4.0.2 in package JSON in repository generic. The Errors section provides a detailed error message explaining the failure.

Errors section

Dry Run

A dry run simulates the act of moving your selected files to Bintray without actually distributing them. This is a good way to ensure your configuration is correct and that there is no impediment to moving your files to Bintray.

Click "Dry Run" to start the simulation. Once completed, Artifactory will display the Success and Error sections as if the files were actually distributed.

Don't get confused

In a dry run, no files are moved; it's just a simulation

Distributing via REST API

JFrog Artifactory exposes a REST API that lets you automate deploying artifacts to Bintray. For details please refer to Distribute Artifact and Distribute Build.