Technology Sharing

Introduction to Gitlab CI/CD

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

basic concept

GitLab CI/CD (Continuous Integration/Continuous Deployment) pipeline is a powerful feature provided by the GitLab platform, designed to improve the efficiency of development teams and the quality of software releases by automating the build, test, and deployment processes.

        CI(Continuous Integration): Continuous integration means frequently integrating code into the trunk and ensuring the stability of the integrated code through automated testing.

        CD(Continuous Delivery/Deployment): Continuous delivery/deployment can be seen as the next step of continuous integration. Continuous delivery means that on the basis of continuous integration, not only the application is automatically built and tested, but also the deployment process can be manually triggered to deploy the application; while continuous deployment goes a step further, and its deployment process is automatically triggered.

Core functions

Automated build: Every time a code commit or merge request is accepted, GitLab CI/CD automatically triggers the build process to ensure that the code can be successfully compiled.It can be understood as GitLab automaticallyrightSubmitted code for building and testingwait.

automated test: After the build is completed, the pipeline will automatically run the test scripts, including unit tests, integration tests, etc., to ensure the quality and stability of the code.

Automated deployment: After the test passes, the pipeline can automatically deploy the application to the specified environment (such as development environment, test environment, production environment), greatly shortening the time from code submission to the production environment.

This is not the case in real life

Generally, we submit code to Git, which has been tested in the local actual environment. We use Git only for code hosting, version control, code review and other operations, and never care about the construction and testing of the code on Gitlab. In addition, due to the submitted dependencies, resources, insufficient cache, concurrency conflicts and other reasons, it may causeCI/CD pipeline errors,This type of error is generally due to the lack of use, and the specific cause is difficult to analyze. Therefore, when using Gitlab,Choose to turn off the CI/CD function

CI/CD pipeline error examples

Disable CI/CD function:

 

result: