Docking with Repos (Git, Svn)

Principle Interpretation

Create components by customizing source code When you fill in the Git address, the platform will automatically determine the protocol of the address. If it is an HTTP Git address, the platform will prompt you to enter the username and password of the Git repository. If it is a public project, the username and password can be omitted. When the entered Git address is SSH protocol, the platform will prompt you to copy Kato’s SSH public key to the Git repository. Kato will generate an independent public key for each team to avoid multi-team key conflicts.

When you fill in the Svn code address, the platform prompts for the account name and password. If it is a private repository, be sure to enter the account.

Operating Procedures

This article mainly explains how to connect privately deployed Git repositories through SSH public keys, taking GitLab as an example to illustrate.

Gitlab Create New Project

If you already have a project, skip this step

New Project

Fill in the project name

Create sample code

After switching to the SSH address, you need to remember the SSH address of the project, which will be used when creating components later. The address here is git@172.16.210.205:test/helloworld.git

Create a new index.html file with the content of hello world, hello gridworkz! Submit.

Configure SSH public key to connect to private repository

Get public key

Enter [Create component]-[Create from source code]-[Custom source code], copy the address of the project’s SSh protocol to the [Git repository address] column, it will prompt [Configure Authorization Key] connection, click to display detailed information :

Add the public key to the Git repository

Switch to the project homepage

Add SSH public key

SSH public key has been added

Test whether the connection is successful

Use the private repository to create components to test whether Gridworkz can obtain the code in the Git repository through SSH.

Create components

Able to recognize language, which means successful docking

Deploy GitLab private repository service in Kato

The above is the situation of docking with existing GitLab. If you do not have a Git repository, Kato can deploy GitLab applications with one click. The following mainly introduces the GitLab deployed on the docking cloud.

Create GitLab application

Search for the GitLab application through [New Application]-[App Market], select the required version and install it.

Configure GitLab

After GitLab is installed, you can see the port number opened to the outside on the port page of the component, as shown below:

  • Port number: the internal listening port of the component. In this example, the port 22 and 80
  • Access address: the address and port mapped by Gridworkz. In this example, the mapped address of port 22 is 172.16.210.205, the port is 20006, and the address of port 80 is 80.grea7fc4.zggk.48mt2.gridworkz.org , The port is 80
  • Kato assigns an access domain name for the component ports of the HTTP protocol by default
  • Kato assigns an access address and a random mapping port for non-HTTP protocol component ports by default, but the port mapping uniquely corresponds to the component port and will not change, so the port in this example may not be consistent with your actual situation.

Set GitLab’s HTTP and SSH addresses

The GitLab component sets the SSH and HTTP addresses through the GITLAB_SSH_HOST and GITLAB_HOST environment variables, so these two variables need to be set in the GitLab component.

After setting environment variables, you need to restart GitLab components.

Port configuration in Git address when creating components

Since the SSH protocol uses the non-default 22 port, when creating a component, the Git address filled in also needs to be added with port information, in the following format:

# default address
git@172.16.210.205:test/helloworld.git

# change into
git@172.16.210.205:20006/test/helloworld.git