gitlab-ci The full name is gitlab continuous
integration What do you mean , That is continuous integration . The central idea is that every time push reach gitlab When , Will trigger a script execution , Then the content of the script includes the test , compile , Deployment and other customized content .

Automatic deployment involves several roles , The main introduction is as follows


This is a set of coordination GitLab Continuous integration system used , yes GitLab Self contained , That's what you pretend to be GitLab It's on the server . There's no need to think about it ..gitlab-ci.yml It is responsible for script parsing .


This is the bearer of the script execution ,.gitlab-ci.yml Of script Part of the operation is done by runner In charge of it .GitLab-CI Browse the .gitlab-ci.yml After the document , According to the rules , Assign to each Runner To run the corresponding script script. Some of these scripts are used for testing projects , Some are for deployment .

This is in the git A file in the root directory of the project , A series of stages and execution rules are recorded .GitLab-CI stay push It will be parsed later , Call according to the content inside runner To run .

once Pipeline In fact, it is equivalent to a construction task , It can contain multiple processes , If the installation depends on , Run the test , compile , Deploy test server , Deployment of production server and other processes .

Stages Represents the construction phase , To put it bluntly, it is the process mentioned above . We can do it once Pipeline More than one is defined in Stages, these ones here Stages It will have the following characteristics :

All Stages It will run in order , That is to say Stage After completion , next Stage Before it starts

Only when all Stages After completion , The build task (Pipeline) Will succeed

If any of them Stage fail , So the back one Stages It won't be implemented , The build task (Pipeline) fail

* Jobs
Jobs Represents the build work , Represents a Stage Work carried out inside . We can Stages It defines multiple Jobs, these ones here Jobs It will have the following characteristics :
* identical Stage Medium Jobs Will be executed in parallel
* identical Stage Medium Jobs When both are executed successfully , The Stage Will succeed
* If any of them Job fail , So it's time Stage fail , This is the build task (Pipeline) fail