Using Artifactory
This feature is only available on the Pro and Enterprise plans.
The Buf Schema Registry (BSR) provides generated SDKs of generated code through standard registry APIs in each language. This makes it easy to configure artifact management tools like Artifactory to work with the BSR.This guide uses the buf.example.com
BSR instance and https://example.jfrog.io
Artifactory instance as examples, but these should be substituted with the domains of your own instances.
Setup
You must be a BSR instance admin to set up Artifactory.
- First, add a new Go remote repository to your Artifactory instance at
https://example.jfrog.io/ui/admin/repositories/remote/new
.- Set Repository Key to
buf-go
- Set URL to
https://buf.example.com/gen/go
- Open the Advanced tab and check Bypass HEAD Requests
- Set Repository Key to
- In your BSR, create a bot user with a token. Then set the User Name and Access Token of the
buf-go
repository in Artifactory to the BSR username and token of the bot user that you created. - Create a new virtual repository named
go
, or use an existing virtual Go repository.- Edit the virtual repository and add
buf-go
to the included items undergo
- Ensure that the
go-remote
remote repository is also added to included items
- Edit the virtual repository and add
Usage
Click Set Up Client/CI Tool on the
go
virtual repository and follow the instructions.Run the following in a terminal to configure Artifactory as the go proxy:
console$ export GOPROXY="https://${ARTIFACTORY_USER}:${ARTIFACTORY_ACCESS_TOKEN}@example.jfrog.io/artifactory/api/go/go"
Stop the go client from trying to resolve the sum with the global sumdb, see the GONOSUMDB documentation for more.
console$ export GONOSUMDB=buf.example.com/gen/go
Install modules:
console$ go get buf.example.com/gen/go/acme/petapis/protocolbuffers/go