CICD concept and jenkins deployment

CICD concept and jenkins deployment

1.CICD process

What is CICD

CICD is short for Continuous Integration, continuous delivery and Continuous Deployment. It refers to the automatic implementation of a series of processes from development to deployment in the development process, so as to minimize manual intervention.

Continuous integration

Continuous integration refers to a series of processes such as testing and building after and pushing the code to the remote warehouse and before this submission is merged into the main branch. Suppose that the code of an application is stored on gitlab, and the developer pushes many submissions every day. For each push, you can create a series of scripts for automatic testing to reduce the probability of introducing errors into the application. This is continuous integration, which can be applied to multiple branches, including development branches.

Continuous deployment

Continuous deployment goes further on the basis of continuous integration, which refers to the deployment of the default branch of the warehouse to the product environment. If this part needs to be triggered manually, it is a Continuous Delivery phase.

CICD process


CI
1. First, the developer writes the corresponding code (after writing, submit the code to gitlub)
2. Write the code and then package it
3. After packaging, deploy.
4. After the release is completed, then the tester tests
(for development, and testing, even if it breaks down, you can redeploy another one)
(it is not suitable for production environments because customers are using it)

CD
Continuous interaction
5. After the tester has no problems, he will put it in the code warehouse (put it in the docker and package it into a docker image)
Continuous deployment
Pull an image from the docker and deploy it in the production environment
6. For continuous deployment, we should release manually, not CICD automatically, because we don't know when to release, we must get an accurate release time, and then go through the process. After the process is passed, we can release manually. All our continuous deployment should be released manually.

2. What is jenkins

Jenkins is an extensible continuous integration engine.

Mainly used for:

  • l continuously and automatically build / test software projects.
  • l monitor some regularly executed tasks.

Jenkins features include:

  • Easy to install - just deploy jenkins.war to the servlet container without database support.
  • l easy to configure - all configurations are implemented through the web interface it provides.
  • l integrate RSS/E-mail to publish the construction results through RSS or notify by e-mail when the construction is completed.
  • l generate JUnit/TestNG test report.
  • l distributed build support Jenkins enables multiple computers to build / test together.
  • l file identification: Jenkins can track which build generates which jars, which build uses which version of jars, etc.
  • l plug in support: it supports extensions. You can develop tools suitable for your team.

function

Automated construction is Jenkins' function. He can use a variety of scripts to help you complete your construction requirements
Jenkins is a continuous integration tool developed based on Java, which is used to monitor continuous repetitive work. Its functions include:
1. Continuous software release / test project.
2. Monitor the work performed by external calls.

3.jenkins deployment

First, we need to deploy tomcat. After tomcat deployment is completed, we will deploy jenkins. Because I have already deployed jenkins, I will deploy jenkins directly

Download package

[root@centos8-1 ~]# wget http://mirrors.jenkins.io/war-stable/2.303.2/jenkins.war
--2021-10-18 02:38:33--  http://mirrors.jenkins.io/war-stable/2.303.2/jenkins.war
 Resolving host mirrors.jenkins.io (mirrors.jenkins.io)... 52.202.51.185
 on connection mirrors.jenkins.io (mirrors.jenkins.io)|52.202.51.185|:80... Connected.
Issued HTTP Request, waiting for response... 302 Found
 Location: http://ftp-chi.osuosl.org/pub/jenkins/war-stable/2.303.2/jenkins.war [follow to new URL]
--2021-10-18 02:38:34--  http://ftp-chi.osuosl.org/pub/jenkins/war-stable/2.303.2/jenkins.war
 Resolving host ftp-chi.osuosl.org (ftp-chi.osuosl.org)... 64.50.236.52, 2600:3402:200:227::2
 on connection ftp-chi.osuosl.org (ftp-chi.osuosl.org)|64.50.236.52|:80... Connected.
Issued HTTP Request, waiting for response... 200 OK
 Length: 72334258 (69M) [application/x-java-archive]
Saving to: "jenkins.war"

jenkins.war                100%[======================================>]  68.98M   251KB/s  Time 4 m 38s  

2021-10-18 02:43:13 (254 KB/s) - Saved“ jenkins.war" [72334258/72334258])

[root@centos8-1 ~]# ls
anaconda-ks.cfg  apache-tomcat-9.0.54.tar.gz  index.jsp  jenkins.war
[root@centos8-1 ~]# 
[root@centos8-1 ~]# cd /usr/local/tomcat/webapps/
[root@centos8-1 webapps]# mv /root/jenkins.war .
[root@centos8-1 webapps]# ls
docs  examples  host-manager   jenkins.war  manager  ROOT  test
[root@centos8-1 webapps]# 
[root@centos8-1 webapps]# ../bin/catalina.sh start
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
[root@centos8-1 webapps]# ls
docs  examples  host-manager  jenkins  jenkins.war  manager  ROOT  test
[root@centos8-1 webapps]# 
[root@centos8-1 webapps]# ss -antl
State      Recv-Q     Send-Q               Local Address:Port           Peer Address:Port     Process     
LISTEN     0          128                        0.0.0.0:22                  0.0.0.0:*                    
LISTEN     0          1               [::ffff:127.0.0.1]:8005                      *:*                    
LISTEN     0          100                              *:8080                      *:*                    
LISTEN     0          128                           [::]:22                     [::]:*                    
[root@centos8-1 webapps]# 

Access test and deploy

We can directly check the password here according to the above path

[root@centos8-1 webapps]# cat /root/.jenkins/secrets/initialAdminPassword
d2860d669db9470e97f9e2269e949047
[root@centos8-1 webapps]# 

Here we click the second (select plug-ins to install), because there are many recommended plug-ins to install

Here we directly install by default





Keywords: Docker jenkins

Added by rammac13 on Tue, 19 Oct 2021 01:10:58 +0300