Import a Code Repository
In KubeSphere 3.3.0, you can import a GitHub, GitLab, Bitbucket, or Git-based repository. The following describes how to import a GitHub repository.
Prerequisites
You have a workspace, a DevOps project and a user (
project-regular
) invited to the DevOps project with theoperator
role. If they are not ready yet, please refer to Create Workspaces, Projects, Users and Roles.You need to enable the KubeSphere DevOps system.
Procedures
Log in to the KubeSphere console as
project-regular
. In the navigation pane on the left, click DevOps Projects.On the DevOps Projects page, click the DevOps project you created.
In the navigation pane on the left, click Code Repositories.
On the Code Repositories page, click Import.
In the Import Code Repository dialog box, enter a name of the code repository, and then select a GitHub repository. Optionally, you can set an alias and add description.
The following table lists supported code repositories and parameters to set.
Code Repository Parameter GitHub Credential: Select the credential of the code repository. GitLab - GitLab Server Address: Select the GitLab server address, and the default value is https:gitlab.com.
- Project Group/Owner: Enter the GitLab username.
- Credential: Select the credential of the code repository.
- Code Repository: Select the code repository.
Bitbucket - Bitbucket Server Address: Set the Bitbucket server address.
- Credential: Select the credential of the code repository.
Git - Code Repository URL: Enter the URL of the code repository.
- Credential: Select the credential of the code repository.
Note
To use a private GitLab repository, please refer to Create a Multi-branch Pipeline with GitLab-Step 4.
In Credential, click Create Credential. In the Create Credential dialog box, set the following parameters:
- Name: Enter a name of the credential, for example,
github-id
. - Type: Optional values include Username and password, SSH key, Access token, and kubeconfig. In DevOps projects, Username and password is recommended.
- Username: The default username is
admin
. - Password/Token: Enter your GitHub token.
- Description: Add description.
Note
For more information about how to create a credential, please refer to Credential Management.
- Name: Enter a name of the credential, for example,
In the GitHub repositories that are displayed, select a repository, and click OK.
Click on the right of the imported code repository, and you can perform the following operations:
- Edit: Edits the alias and description of the code repository and reselects a code repository.
- Edit YAML: Edits the YAML file of the code repository.
- Delete: Deletes the code repository.