Container Registry allows you to create a GitLab source code repository and access the repository through GitLab API V3 or V4. This topic describes the procedure for creating a GitLab source code repository in the Container Registry console.

Step 1: Obtain an access token for GitLab

  1. Obtain an access token for GitLab.Obtain an access token for GitLab
  2. Select the api check box in the Scopes section. This allows Container Registry to obtain information about the source code repository and set the callback hook for automatically building images from source code through the API.
    Note If the access token you obtained does not have sufficient permissions, you will fail to create a source code repository in the Container Registry console. In addition, pay attention to the validity period of the access token.
    Select the api check box in the Scopes section

Step 2: Bind Container Registry to your GitLab account

  1. Log on to the Container Registry console. In the left-side navigation pane, click Code Source. On the Code Source page that appears, click Bind Account next to GitLab.Bind Container Registry to your GitLab account
  2. In the Private GitLab dialog box that appears, set the following parameters:
    • URL: Enter the URL of your self-built GitLab, such as https://my-gitlab.com. Do not enter the URL of a specific repository.
    • Username: Enter the username on GitLab.

      To obtain the username, click your profile picture on GitLab in the upper-right corner, as shown in the following figure. This username is the credential for logging on to GitLab.

      GitLab username
    • Private Token: Enter the access token obtained in Step 1.
  3. Click Bind Account.
Note Currently, you cannot access GitLab over a firewall or through a self-signed HTTPS certificate. Make sure that GitLab is accessible over the public network.

Step 3: Create a GitLab source code repository

Each account can create a maximum of 100 GitLab source code repositories. We recommend that you select a namespace and a repository name from the drop-down lists or enter them in the text boxes.

Create a repository

Troubleshooting

  • What can I do if I receive the error message "Failed to access the source code repository site. Please confirm that the account binding information is correct, or try again later."?
    The possible causes for the error are as follows:
    • GitLab does not respond to your access request. Make sure that GitLab is accessible over the public network, no firewall is deployed on the network used to access GitLab, and you do not use a self-signed HTTPS certificate to access GitLab. Verify that the account binding information, including the GitLab URL, username, and access token, is correct.
    • Your GitLab access request times out due to network issues. Try again later.
  • What can I do if I receive the error message "The source code repository site returns an error response. Please confirm that the account binding information is correct."?
    If this error occurs, you can access GitLab normally, but GitLab returns an error.
    • Verify that the access token has been granted complete read/write access to the GitLab API and has not expired.
    • Verify that the specified username has the permission to set the callback hook. To check whether the username has sufficient permissions, log on to GitLab and choose Repository name > Settings > Integrations. On the Integrations page that appears, check whether Push events in the Trigger section is selected.
Check settings on the Integrations page