Source Code Repository Authorization

Last updated: 2020-04-21 12:36:33

    Scenario

    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.
    3. In the Code Source Authorization window that appears, select an option as needed, as shown in the following figure.

      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.

    Authorizing GitHub

    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.

    Authorizing GitLab

    ">

    Obtaining a GitLab access token

    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.
      • 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.
      1. 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.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help