Skip to content

Using JFrog Artifactory

Loreli Cadapan edited this page Jan 28, 2019 · 1 revision

Using JFrog Artifactory (Recommended)

Why

Using Artifactory with GoCenter guarantees fully reproducible builds and the best experience for both modules existing in GoCenter and modules that exist locally.

We strongly recommend using JFrog CLI to complement the developer experience.

Accessing GoCenter via Artifactory

Using plain go

Once Artifactory is configured to work with GoCenter (see below), you can use go to build against Artifactory using the standard GOPROXY approach. Please note that based on the settings of your Artifactory server you'll need to take care of proper client authorization (which might be challenging as currently the go client doesn't send credentials when retrieving modules). Instead, we recommend using JFrog CLI (see below).

Using JFrog CLI (Recommended)

Once Artifactory is configured to work with GoCenter (see below) and JFrog CLI is configured to work with Artifactory, use jfrog rt go build (or other Go commands, prefixed with jfrog rt) to retrieve the dependencies from Artifactory.

JFrog CLI also introduces a special build-publish command, which allows you to easily upload the modules which were created for a given build to Artifactory. Check the JFrog CLI documentation for more information.

Another key benefit of using JFrog CLI is its built-in support for generating and publishing metadata about the build process (the "build-info"). Gathering this information during your CI server builds is critical for your DevOps process. Read more about it in the JFrog CLI documentation.

Configuring JFrog Artifactory to work with GoCenter

Versions 6.7 and later of JFrog Artifactory work with GoCenter.

Log in as an administrator user to Artifactory. Pick the "Quick Setup" from the "Create Repositories" dropdown menu appearing when you click on your username on the Artifactory home screen. Select "Go", and click "Create". The wizard will generate 3 Go repositories (see more about the concept of repositories and their types in Artifactory User Guide):

  • A go-local local repository for the modules deployed locally (usually using the build-publish command of the JFrog CLI).
  • One or more remote repositories (depending on the version of Artifactory, see below). Those proxy and cache modules downloaded from remote repositories.
  • A go virtual repository which provides simple and unified access to an aggregation of local and remote repositories.

Artifactory 6.8 and later

Version 6.8 of Artifactory and later automatically preconfigures a gocenter remote repository for you. Once you use the "Quick Setup" wizard to create a set of Go repositories, you have GoCenter preconfigured as a remote repository and it's a part of the virtual repository, ready to use.

Artifactory 6.7

This version of Artifactory creates a go-remote remote repository that points to GitHub as the remote URL. Adding a GoCenter remote repository is easy.

  1. Log in as an administrator user to Artifactory. Pick the "Remote Repository" from the "Create Repositories" dropdown menu appearing when you click on your username on the Artifactory home screen.
  2. In the repository creation wizard, select "Go" as the repository type, provide gocenter as the repository key and https://gocenter.io/ as the URL. Click "Save and Finish"
  3. In the "Admin" panel, click on "Virtual" in the repositories list and click on the go virtual repository to edit it.
  4. Using the right arrow, move the newly created gocenter repository into the list of selected repositories on the configuration screen. Click "Save and Finish".

How it works

The following diagram demonstrates the module request flow with JFog Artifactory, JFrog CLI and GoCenter: Artifactory flow with GoCenter