Connect to a source code platform

更新时间:
复制 MD 格式

To build images from source code, connect your Container Registry Enterprise Edition instance to a source code hosting platform.

Prerequisites

Background information

Container Registry Enterprise Edition supports the following source code hosting platforms:

Code platform

Platform version

Connection method

Build trigger limits

Codeup

All

personal access token

None

Gitee

Personal Edition instances are not supported.

All

Gitee OAuth authorization

None

GitHub

Only personal accounts are supported.

GitHub OAuth authorization

None

GitLab

All

personal access token

None

Bitbucket

All

Bitbucket OAuth authorization

None

Connect an Enterprise instance to Codeup

Note

You must have administrator permissions in Codeup and be logged in with an administrator account.

  1. Create a personal access token in Codeup.

    1. Log on to Codeup.

    2. On the Codeup page, click your profile avatar and then select Personal Settings.

    3. In the left-side navigation pane of the Personal Settings page, click Personal Access Token.

    4. Click New Token. Configure Token Name and Expiration Date, select the required permissions, and then click Create. Read the Security Notice and then click OK, I understand the risks.

      The personal access token requires the following minimum permissions.

      • Organization Management

        • Organization members: Read-only

        • Organization departments: Read-only

      • Code Management

        • Code repositories: Read-only

        • Branches: Read-only

        • Tags: Read-only

        • Webhook: Read/Write

      After the personal access token is created, it is displayed on the page.

      The personal access token is displayed only once. Click the copy icon to save it immediately.

  2. Connect the Codeup platform.

    1. Log on to the Container Registry console.

    2. In the top navigation bar, select a region.

    3. In the left-side navigation pane, click Instances.

    4. On the Instances page, click the Enterprise Edition instance that you want to manage.

    5. On the instance management page, choose Repository > Code Source.

    6. On the Code Source page, find Codeup and click Bind Account in the Actions column.

    7. In the dialog box that appears, set the parameters and click Confirm.

      • Endpoint: Leave this field blank.

        Note

        When you connect to Codeup, the system automatically detects the URL.

      • Personal access token: Enter the personal access token that you created in Step 1.

      On the Code Source page, if Bound is displayed in the Status column for Codeup, the connection is successful.

Connect an Enterprise instance to Gitee

  1. Log on to the Container Registry console.

  2. In the top navigation bar, select a region.

  3. In the left-side navigation pane, choose Instances.

  4. On the Instances page, click the Enterprise Edition instance that you want to manage.

  5. On the instance management page, choose Repository > Code Source.

  6. On the Code Source page, find Gitee and click Bind Account in the Actions column.

  7. In the Gitee dialog box, click Go to the source code repository to bind account.

  8. On the Gitee sign-in page, enter your username and password, and then click Logon.

  9. On the Gitee authorization page, confirm the authorization information and click Confirm Authorization Policy.

    You are redirected to the Container Registry console, and a message appears indicating that you have successfully connected your Gitee account.

Connect an Enterprise instance to GitHub

  1. Log on to the Container Registry console.

  2. In the top navigation bar, select a region.

  3. In the left-side navigation pane, choose Instances.

  4. On the Instances page, click the Enterprise Edition instance that you want to manage.

  5. On the instance management page, choose Repository > Code Source.

  6. On the Code Source page, find GitHub and click Bind Account in the Actions column.

  7. In the GitHub dialog box, click Go to the source code repository to bind account.

  8. On the GitHub sign-in page, enter your credentials and click Sign in.

  9. On the Authorize Aliyun Container Registry page, confirm the authorization information and click Authorize AliyunDeveloper.

    You are redirected to the Container Registry console, and a message appears indicating that you have successfully connected your GitHub account.

Connect an Enterprise instance to Bitbucket

  1. Log on to the Container Registry console.

  2. In the top navigation bar, select a region.

  3. In the left-side navigation pane, choose Instances.

  4. On the Instances page, click the Enterprise Edition instance that you want to manage.

  5. On the instance management page, choose Repository > Code Source.

  6. On the Code Source page, find Bitbucket and click Bind Account in the Actions column.

  7. In the Bitbucket dialog box, click Go to the source code repository to bind account.

  8. On the Bitbucket login page, enter your email, username, and password as prompted, and then click Logon.

  9. On the Bitbucket authorization page, confirm the authorization information and click Grant access.

  10. In the Bind Account dialog box, select the Instance Edition, Region, and Instance. Then, click Confirm.

    On the Code Source page, if Bound is displayed in the Status column for Bitbucket, the connection is successful.

Connect an Enterprise instance to GitLab

If you use a self-managed GitLab instance, note the following port requirements:

  • HTTP service

    By default, port 80 is used. To use a different port, you must manually append the port number to the trigger URL. You can use only the following ports: 80, 21, 443, 70, 210, 280, 488, 591, 777, and ports from 1025 to 65535.

  • HTTPS service

    By default, port 443 is used. Only the default port 443 is supported. If you want to use a different port, use the HTTP service.

Note

Connecting to GitLab instances that are behind a firewall or use a self-signed HTTPS certificate is not supported. To connect to a private GitLab instance within a VPC, see Build container images by using the secure build mode for VPCs.

  1. Create a personal access token in GitLab.

    1. Log on to GitLab with an administrator account.

    2. On the GitLab page, click your profile avatar and select Settings.

    3. In the left-side navigation pane of the User Settings page, click Access Tokens.

    4. On the Access Tokens page, set a name and expiration date, and then click Create personal access token.

      After an access token is successfully created, you can view it on the Access Tokens page. The page displays the generated personal access token. Click the copy button to save the token value. This token is displayed only once and cannot be viewed again after you leave the page.

  2. Connect the GitLab platform.

    1. Log on to the Container Registry console.

    2. In the top navigation bar, select a region.

    3. In the left-side navigation pane, click Instances.

    4. On the Instances page, click the Enterprise Edition instance that you want to manage.

    5. On the instance management page, choose Repository > Code Source.

    6. On the Code Source page, find GitLab and click Bind Account in the Actions column.

    7. In the dialog box that appears, set the parameters and click Confirm.

      • Endpoint: Enter the login URL of your GitLab instance.

        • If you use a self-managed GitLab instance, enter its login URL.

        • If you use the public GitLab service, enter its login URL.

      • Username: Enter your GitLab username.

      • Private Token: Enter the personal access token that you created in Step 1.

      On the Code Source page, if Bound is displayed in the Status column for GitLab, the connection is successful.

Related documents

If the connection to a source code hosting platform fails, see FAQ about source code repositories for troubleshooting steps.