tencent cloud

Feedback

Source Code Repository Authorization

Last updated: 2020-12-15 12:21:50

    Overview

    Before using a Git repository to build container images, you need to authorize TKE to access the code source. Currently, TKE supports GitHub repository and GitLab repository.

    Prerequisites

    You have logged in to the TKE console.

    Directions

    Selecting a code source

    1. Choose Image Repository > My Images in the left sidebar.
    2. On the My Images page, click Source Authorization, as shown in the following figure.

      Note:

      ”Source Authorization” is only available in China mainland, namely the “Default Region” on the console.


    3. In the Code Source Authorization window that appears, select an option as needed, as shown in the following figure.

    Note:

    A user can authorize both GitHub and GitLab accounts at the same time, but only one account of each type. To change your bound GitHub or GitLab account, you need to unbind the original account.

    • If your repository is on GitHub, see Authorizing GitHub to complete the authorization.
    • If your repository is on an on-premises GitLab server or a GitLab managed server, see Authorizing GitLab to complete the authorization.

    Github authorization

    1. In the Code Source Authorization window, click Authorize to sync Github code source.
    2. For the first time of authorization, you will be directed to the GitHub website and see a prompt stating that the app needs to access your repositories and personal data, as shown in the following figure.
    3. Click Authorize to finish authorizing a GitHub repository, as shown in the following figure.

    Gitlab authorization

    Obtaining the Access Token of GitLab

    1. Log in to the GitLab website and go to the Create Access Token page, as shown in the following figure.
      1. Click your profile photo. In the drop-down menu, select Settings.
      2. In the left pane of the "User Settings" page, click Access Tokens to go to the Create Access Token page.
        On the “Create Access Token" page, set the following information as needed:
      • Name: enter a name for the new access token.
      • Expires at: set the expiration date of the new access token.
      • Scopes: set the access scope of the new access token. The API option is required.

        Note:

        • The API option is required for Scopes. Otherwise, you will not be able to obtain source repository information or set callback hooks for auto building.
        • Set a reasonable expiration date for the token to ensure that it is always valid during usage.
    2. Click Create and save the created access token, as shown in the following figure.

    Authorizing GitLab code source synchronization

    1. In the Code Source Authorization window, click Authorize to sync GitLab code source and enter the following information:
      • Service address: indicates the URL of the GitLab server, which must use the HTTP or HTTPS protocol and can be accessed over the public network. For example, https://you-gitlab.com. Do not enter the URL of a specific project or repository.
      • Private token: must be the Access Token. If you do not have the Access Token yet, see Obtaining a GitLab access token and create one.
    2. Click OK to finish the authorization, as shown in the following figure.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support