Proxy GitLab with Go

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

Go Proxy Best Practice: Add Mirror Repository

We highly recommend that you create a remote repository pointing to the default Go mirror (proxy.golang.org) and enter Artifactory as the Git provider. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see Set Up Go Proxy Mirror Repositories.

To create a remote repository that serves as a caching proxy for GitLab, follow these steps:

  1. In Artifactory, click the Administration tab and select Repositories in the Navigation bar.

  2. Click the Create Repository button and select Remote from the dropdown menu. The Select Package Type screen appears.

  3. Select Go for the package type. The New Remote Repository screen for the Go package type appears, as shown below.

    Create_Go_remote_repo.png
  4. Set the Repository Key value, and enter the link to your GitLab environment in the URL field:

    • For GitLab Self-managed, enter your environment link

    • For GitLab SaaS, enter https://gitlab.com/

  5. Under Go Settings, set the Git Provider as GitLab. The Resolve Subgroups check box appears, as shown below.

    Resolve_subgroups_checkbox.png
  6. Select the Resolve Subgroups checkbox if you want Artifactory to automatically resolve sub-groups from gitlab.com rather than identifying them as sub-modules.

  7. Enter your GitLab username and password. To generate a GitLab password:

    1. Go to your GitLab account, click your avatar in the top right corner, and select Settings.

    2. Go to Access Tokens, and click Add new token.

      Gitlab_personal_acces_stoken.png
    3. Enter a name and select permissions for your token: select the api and read_api permissions, and add other permissions according to your environment. When you are done, click Create personal access token.

      gitlab_token_creation.png
    4. Copy the token you created, and paste it into the Password field in Artifactory.

  8. Click Save & Finish.

  9. Create a new virtual repository and under Repositories, select the remote repository you have created.

  10. Under Include/ Exclude Patterns, add the include pattern for GitLab, and click the + sign to add the pattern.

    • For GitLab Self-managed, enter your environment URL in this structure: **/<YOUR_URL>/**

    • For GitLab SaaS, enter **/gitlab.com/**.

    You can use the virtual repository to resolve artifacts from your GitLab private registry.