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
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 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.
2. Click your profile photo. In the drop-down menu, select Settings.
3. 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.
4. 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.
2. Click OK to finish the authorization, as shown in the following figure.
Was this page helpful?