GitLab

I personally use GitHub, and I use GitLab for work because they usually work in an internal network environment, and GitLab supports configuration on internal network servers. The following is the process of installing and building GitLab on my own Linux system.

我个人使用的是GitHub,工作中使用的是GitLab,因为他们平常工作环境都在内网中,而GitLab支持在内网服务器搭配配置。下面是我在自己在Linux系统上安装搭建的GitLab的过程。

Overall Architecture

Ⅰ Installation Steps

I installed it on my own virtual machine, and the system is KylinServerV10SP1.

我是在自己的虚拟机上安装,系统是KylinServerV10SP1。

1 Install Dependencies

1
yum -y install openssh-server openssh-clients postfix cronie curl

Then I found out that it had already been installed.

2 Download Package

Version reference: gitlab/gitlab-ce - Packages · packages.gitlab.com

Please note that you need to download the el8 version.

1
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/8/gitlab-ce-16.11.6-ce.0.el8.x86_64.rpm/download.rpm

3 Install Gitlab

1
sudo yum install gitlab-ce-16.11.6-ce.0.el8.x86_64

4 Configure External Access Connection

1
2
3
4
5
ifconfig

vim /etc/gitlab/gitlab.rb

external_url'http://192.168.152.133/'

5 Modify Service Port

6 Recofigure

Overload configuration and initialize all configurations. Make the modified configuration take effect immediately.

重载配置,初始化所有配置。使修改后的配置立即生效。

1
gitlab-ctl reconfigure

7 Stop, Start, Restart, Status Command

1
2
3
4
gitlab-ctl stop
gitlab-ctl start
gitlab-ctl restart
gitlab-ctl status

8 View Log

1
gitlab-ctl tail

9 Password

1
cat /etc/gitlab/initial_root_password

root login:

10 Open Port

Search for ‘listen’ in the configuration file, modify socket port.

11 Access

12 Other

GitLab Documentation

GitLab使用技巧-GitLab中文网站

一文掌握:Gitlab的完整使用手册-阿里云开发者社区一文掌握:Gitlab的完整使用手册-阿里云开发者社区

Ⅱ Configure Gitlab

1 Configure Email SMTP

Generally, there is a dedicated SMTP for internal networks.

SMTP settings | GitLab

2 Open LDAP

Integrate LDAP with GitLab | GitLab

3 Backup and Restore

    gitlab.rb

    gitlab-secrets.json

Backup | GitLab

4 Configure Git Storage Repository Directory

SonarQube

Because my computer performance is average and the virtual machine cannot be moved, all subsequent operations will be completed in my physical machine (Win11) environment.

由于我的计算机性能一般,虚拟机无法移动,因此所有后续操作都将在我的物理机(Win11)环境中完成。

Introduction

    SonarQube is an open platform for managing code quality

  • It can quickly locate potential or obvious errors in the code.

  • At present, it supports code quality management and detection for more than 20 programming languages such as Java, C #, C/C++, Python, PL/SQL, Cobol, JavaScript, Groovy, etc.

  • Integrate Jenkins and DevOps for CI/CD work.

    Seven dimensions to check code quality

  • Complexity distribution: If the code is too complex, it will be difficult to understand

  • Duplicate code: The program contains a large amount of copied and pasted code, resulting in bloated code. Sonar can display areas with severe duplication in the source code

  • Unit tests statistics: Statistics and displays the coverage of unit tests, allowing developers or testers to clearly understand the coverage of test code

  • Code rules check: Check whether the code complies with specifications through Findbugs, PMD, CheckStyle, etc

  • Comment rate: If there are too few code comments, especially after personnel changes, it is difficult for others to take over; If there are too many, it is not conducive to reading

  • Potential bugs: Detecting potential bugs through Findbugs, PMD, CheckStyle, etc

  • Architecture&design: Identify loops, display dependencies between packages and classes, and check coupling between programs

Ⅰ Installation

https://www.sonarsource.com/products/sonarqube/

初体验Sonar10.6 之 从部署到实战-WinFrom控件库|.net开源控件库|HZHControls官网

Environment: JDK17, PostgreSQL 12

PostgreSQL 11 or greater

sonarqube配置postgresql数据库

PostgreSQL 12.2 手册

SonarScanner CLI

Ⅱ analysis

如何使用sonar在本地对代码进行扫描? - bingo彬哥 - 博客园

sonarqube使用教程 - 吕林光 - 博客园

Devops——Sonarqube+github构建_github 集成 sonarqube-CSDN博客

Gerrit

Gerrit is usually located in the front layer of the final code repository, used for manual code review and validation of CI task triggers. Usually integrated with GitLab. It can also be integrated with Jenkins.

gerrit一般位于最终代码仓库的前一层,用于代码的人工审核和对CI任务的触发进行验证。通常和gitlab集成。它也可以与Jenkins集成。