Bintray Distribution Repositories

JFrog Release Information

Content Type
Release Notes
ft:sourceType
Paligo
Overview

Distribution repositories provide an easy way to move artifacts from Artifactory to Bintray, for distribution to end users. As opposed to other repositories, 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 Bintray Distribution Repository

The following workflow describes the main steps for creating a Bintray Distribution repository:

  1. Create a Bintray Distribution repository in the JFrog Platform.

  2. Connect to Bintray: Obtain authorization from your Bintray account for Artifactory to connect and deploy packages.

  3. Configure distribution: Set the basic distribution parameters.

  4. Configure Advanced Settings: Set the advanced settings.

  5. Define rules: Set the rules that govern how this distribution repository will deploy packages to Bintray.

Creating the Repository
  1. Access your Distribution repositories in the Administration module under Repositories | Repositories | Distribution tab.

  2. From the New dropdown, select New Bintray Distribution Repo.Bintray_distribution_repo.png

Connecting to Bintray

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

AuthorizeWithBintray.jpg

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.

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

AuthorizationCode.jpg

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

PasteCode.jpg

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.

BintrayOauthApplications.jpg
Setting Basic Distribution Parameters

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

Basic Distribution Parameters

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

DistRepoBasicSettings.jpg

Field

Description

Repository Key‹

The repository key.

GENERAL

Description

A description of the repository.

BINTRAY PRODUCT

Use This Repository To Distribute a Product

When 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 Name

The product name.

BINTRAY APPLICATION

customer ID

The client ID assigned by Bintray to Artifactory as an authorized application.

Organization

The 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

Licenses

Specifies the OSS licenses that should be attached to any packages distributed through this repository.

VCS URL

Specifies the VCS URL for packages distributed through this repository.

Advanced Settings
AdvancedSettings.jpg

Field

Description

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.

DistRepoRules.jpg

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.

RuleParameters.jpg

Field

Description

Name

A logical name for this rule

ARTIFACTORY INPUT

Parameters that determine which packages in Artifactory this rule applies to.

Package Type

Specifies the artifact package type for which this rule should be applied. Artifacts of other package types are ignored

Available Tokens

According to the package type selected, this specifies which tokens can be used to specify the deployment path in Bintray

Repository Filter

Wildcard expression that specifies for which original source repositories this rule should be applied. Packages in other repositories are ignored.

Path Filter

Wildcard 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.

Repository

The Bintray repository to which artiafcts should be deployed.

Package

The Bintray package in the specified Bintray repository to which the artifact should be deployed. If the package does not exist, it will be created

Version

The 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.

Path

The 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

x

The 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:

name

A logical name for the capture group

regex

The 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

name

The 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.

DistributeFromUI.jpg

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

DistributeDialogDry.jpg

Field

Description

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.Logging

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.

Unticking Distribute Artifacts Asynchronouslywill produce a UI screen representing the progress and summary of the distribution process:

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.

SuccessSection.jpg

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.

ErrorsSection.jpg
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.Distribute ArtifactDistribute Build

.