Cloud customer?
Start for Free>
Upgrade in MyJFrog >
What's New in Cloud >





Overview

Today, many technologies that are consumed as pure source files are deployed as binaries (for example, PHP, Rails, Node.js, Ruby etc.). As a Binary Repository Manager, Artifactory completes the picture by providing you an easy, safe and secure way to consume those binaries through support for VCS repositories.

Artifactory support for VCS provides:

  1. The ability to list all the tags and branches of any VCS repository.
  2. Access to remote VCS repositories such as GitHub (https://github.com) and Bitbucket (https://bitbucket.org) throughRemote Repositorieswhich provide the usual proxy and caching functionality.
  3. On-demand local caching of tags and branches for later use in case of network instability or hosted VCS service downtime.
  4. The ability to assign access privileges according to projects or development teams.

配置

Repository Layout

VCS repositories require an appropriate repository layout to support a more hierarchical layout of the cached items.

To use a hierarchical layout for your repository, you can either use the built-invcs-defaultlayout that comes with Artifactory out-of-the-box, or define aCustom Layout. This will ensure that different maintenance features like Version Cleanup will work correctly.

Page Contents

Integration Benefits

Repository layout is final

创建一个远程存储库之后你不能查nge it's layout so we recommend that you define it beforehand.

Built-in Custom Layout: vcs-default

Artifactory'sbuilt-indefault layout for VCS repositories (vcs-default) can work with both GitHub and BitBucket.


Below is an example of aCustom Layoutnamedvcs-default:

You can configure the Custom Layout, or simply copy the below code snippet into the relevant section in theAdministrationmodule,underRepository Management|Layouts.

 vcs-default [orgPath]/[module]/[refs]/[baseRev]/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] false .* [a-zA-Z0-9]{40} 


If a repository package layout is in a corresponding folder hierarchy, the Artifactory Version Cleanup tool correctly detects previously installed versions.
Version Cleanup


Searching for artifact versions using the REST API also works properly:

$ curl "http://localhost:8081/artifactory/api/search/versions?g=jquery&a=jquery&repos=github-cache" { "results" : [ { "version" : "2.0.3", "integration" : false }, { "version" : "master-062b5267d0a3538f1f6dee3df16da536b73061ea", "integration" : true } ] }

Remote Repositories

You need to create aRemote Repository作为一个缓存代理github.com. If necessary, you can do the same forbitbucket.orgor any otherremote git repository that you need.

Artifacts (such astar.gzfiles) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however, you can not manually deploy artifacts to a remote repository.

To create a remote repository to proxygithub.comor an on-prem GitHub Enterprise repository, follow the steps below:

  1. In theAdministrationmodule, underRepositories| Repositories | Remote,clickNew Remote Repositoryand setVCSto be thePackage Type.
  2. Set theRepository Key, and specify theURLto behttps://github.com(or your GitHub Enterprise URL endpoint) as displayed below:


  3. Under VCS Settings, select the GitHub provider in theGit Providerfield and clickSave & Finish.

Git Providers

Artifactory supports proxying the following Git providers out-of-the-box: GitHub, Bitbucket, Stash, a remote Artifactory instance or a custom Git repository as displayed below:

Use the custom provider if you have a Git repository which does not exist in the pre-defined list. In this case, you need to provide Artifactory with the download paths for your Git tarballs.

You do so by providing 4 placeholders:

Placeholder Description
{0} Identifies the username or organization name.
{1} Identifies the repository name.
{2} Identifies the branch or tag name.
{3} Identifies the file extension to download.

For example, GitHub exposes tarball downloads at:https://github.com///archive/.

Therefore, the custom download path configured for Artifactory should be{0}/{1}/archive/{2}.{3}

Using Stash or Bitbucket

If you are using Stash or BitBucket, you need to download and install theBitBucket Server Archive Plugin.

Once the JAR is downloaded, select it in your Stash UI, underAdministration | Manage add-ons | Upload add-on.

Once you have installed the add-on you need to restart Stash.


Using the API

VCS repositories must be prefixed with api/vcs in the path

When accessing a VCS repository through Artifactory, the repository URL must be prefixed withapi/vcsin the path.

For example, if you are using Artifactory standalone or as a local service, you would access your VCS repositories using the following URL:

http://localhost:8081/artifactory/api/vcs/

Or, if you are using Artifactory Cloud, the URL would be:

https://.jfrog.io/artifactory/api/vcs/

Artifactory exposes REST APIs that let you do the following with VCS repositories:

To help you build the API call correctly, you can select the VCS repository you want to interact with and clickSet Me Up.

Set Me Up for VCS Repositories


Examples

Below are some examples of working with the API using cURL:

Download jquery master branch from GitHub
curl -i "http://localhost:8080/artifactory/api/vcs/downloadBranch/github/jquery/jquery/master"
Download a specific tag from Bitbucket
curl -i "http://localhost:8080/artifactory/api/vcs/downloadTag/bitbucket/lsystems/angular-extended-notifications/1.0.0"
Download a file within the tag 2.0.1 of jquery, '!' is escaped as '%21'
curl -i "http://localhost:8080/artifactory/api/vcs/downloadTagFile/github/jquery/jquery/2.0.1%21AUTHORS.txt"

When files are already cached, you can conditionally request them using a properties query param:

Download a file within the tag 2.0.1 of jquery, '!' is escaped as '%21'
curl -i "http://localhost:8080/artifactory/api/vcs/downloadBranch/github/jquery/jquery/2.0.1?properties=qa=approved"

Accessing Private VCS Repositories

Artifactory also supports accessing private VCS repositories such as a private GitHub or any self-hosted authenticated one.

To do so, simply add your credentials underAdvanced Settingsof the remote repository configuration panel.

Credentials when redirected

Some git providers (GitHub included) redirects download requests to a CDN provider.

You will need your credentials to pass along with the redirected request, simply check theLenient Host Authenticationand the credentials will pass transparently on each redirected request.

  • No labels
Copyright © 2022 JFrog Ltd.