1. Introduction to continuous integration system
1. Core value:
Integrate automated testing to reduce duplication of labor
Find and solve defects as early as possible to reduce risks
Form an organic whole and clarify stage deliverables
2. Common integration solutions
a. Staged
Create different CI cycle cycles for different build test suites.
Unit tests run for a short time and provide quick feedback, so they can be performed frequently.
Automated tests take a long time and take up more resources. Properly reduce the number of integrations
b. Procedural
Unitize and execute each step sequentially
Separate build and test to save time
c. Pipeline
All process units run in the context of the same pipeline, and the code base is the same.
When the continuous integration server finds new code, it will create a new pipeline.
All process units run in this pipeline.
The products produced by each unit Also valid in this pipeline
Two, Jenkins installation
1. Download the image
docker pull jenkins/jenkins:lts
2. Create jenkins related directories on the host machine
[root@mylinux1 ~]# mkdir jenkins
[root@mylinux1 ~]# chmod 777 jenkins/
3. Run the container
[root@mylinux1 ~]# docker run -d --name jenkins_1 -v /root/jenkins:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
b82867d9d32a43de2bd2092734991df3331edace8b83fbb32da783f5c902e480
[root@mylinux1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b82867d9d32a jenkins/jenkins:lts "/usr/bin/tini -- /u…" 3 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:50000->50000/tcp, :::50000->50000/tcp jenkins_1
7658145222be selenium/node-chrome:4.0.0-rc-2-prerelease-20210923 "/opt/bin/entry_poin…" 19 hours ago Up 19 hours 0.0.0.0:5902->5900/tcp, :::5902->5900/tcp node
8d12663e9da0 selenium/hub:4.0.0-rc-2-prerelease-20210923 "/opt/bin/entry_poin…" 19 hours ago Up 19 hours 0.0.0.0:5442->4442/tcp, :::5442->4442/tcp, 0.0.0.0:5443->4443/tcp, :::5443->4443/tcp, 0.0.0.0:5444->4444/tcp, :::5444->4444/tcp hub
60ed0289df5b registry:2 "/entrypoint.sh /etc…" 29 hours ago Up 23 hours 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry
4. Access jenkins
5. Find the password
[root@mylinux1 secrets]# docker exec -it jenkins_b bash
jenkins@64def9bd8a8a:/$ cd /var/jenkins_home/secrets/
jenkins@64def9bd8a8a:~/secrets$ cat initialAdminPassword
b1a41c7481c94421bf1498ab3e56334a