[continuous integration and delivery] Jenkins environment construction: Jenkins introduction, download and installation

Posted by LanHorizon on Sat, 19 Feb 2022 05:22:38 +0100

preface

I always wanted to learn automated testing, but I didn't take action. I studied piecemeal in my spare time and recorded 20210424.

 

11. Continuous integration and delivery

  • Jenkins environment construction
  • Project environment configuration
  • Email notification
  • Scheduled project execution

 

Jenkins introduction

  • Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous and repeated work. It aims to provide an open and easy-to-use software platform to make continuous integration of software possible.

1. Jenkins features include

1. Continuous software release / test project.

2. Monitor the work performed by external calls.

2. jenkins features include

1. Easy to install - just put Jenkins War is deployed to the servlet container without database support.

2. Easy to configure - all configurations are implemented through the web interface it provides.

3. Integrate RSS/E-mail to publish the construction results through RSS or notify by e-mail when the construction is completed.

4. Generate JUnit/TestNG test report.

5. Distributed build support Jenkins enables multiple computers to build / test together.

6. File identification: Jenkins can track which build generates which jars, which build uses which version of jars, etc.

7. Plug in support: support extension plug-ins. You can develop tools suitable for your team.

For the above, refer to Jenkins Baidu to know the results

 

Jenkins environment construction

1. Download and install JDK

2. Download and install Jenkins. Download address of official website: https://www.jenkins.io/zh/download/

The download will take some time

3. Start mode

(1) After downloading, put the jenkins package into webapps / under tomcat and start tomcat

(2) Run it in the download path: Java - jar Jenkins War -- httpport = 8081 (it is recommended to modify the port number, which is 8080 by default)

The specific steps are as follows: (I choose the second one because I have other projects running in tomcat)

~ % cd Downloads
Downloads % mkdir jenkins
Downloads % mv jenkins.war jenkins
Downloads % cd jenkins
jenkins % ls
jenkins.war
jenkins % java -jar jenkins.war --httpPort=8081
Running from: /Users/ff/Downloads/jenkins/jenkins.war
webroot: $user.home/.jenkins
2021-04-24 02:40:20.700+0000 [id=1]	INFO	org.eclipse.jetty.util.log.Log#initialized: Logging initialized @321ms to org.eclipse.jetty.util.log.JavaUtilLog
2021-04-24 02:40:20.801+0000 [id=1]	INFO	winstone.Logger#logInternal: Beginning extraction from war file
2021-04-24 02:40:22.221+0000 [id=1]	WARNING	o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2021-04-24 02:40:22.276+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: jetty-9.4.39.v20210325; built: 2021-03-25T14:42:11.471Z; git: 9fc7ca5a922f2a37b84ec9dbc26a5168cee7e667; jvm 1.8.0_211-b12
2021-04-24 02:40:22.582+0000 [id=1]	INFO	o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-04-24 02:40:22.619+0000 [id=1]	INFO	o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2021-04-24 02:40:22.619+0000 [id=1]	INFO	o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2021-04-24 02:40:22.620+0000 [id=1]	INFO	o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
2021-04-24 02:40:22.992+0000 [id=1]	INFO	hudson.WebAppMain#contextInitialized: Jenkins home directory: /Users/zhengxiaofang/.jenkins found at: $user.home/.jenkins
2021-04-24 02:40:25.772+0000 [id=1]	INFO	o.e.j.s.handler.ContextHandler#doStart: Started w.@20312893{Jenkins v2.277.3,/,file:///Users/ff/.jenkins/war/,AVAILABLE}{/Users/ff/.jenkins/war}
2021-04-24 02:40:25.800+0000 [id=1]	INFO	o.e.j.server.AbstractConnector#doStart: Started ServerConnector@5c86a017{HTTP/1.1, (http/1.1)}{0.0.0.0:8081}
2021-04-24 02:40:25.801+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: Started @5421ms
2021-04-24 02:40:25.802+0000 [id=24]	INFO	winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2021-04-24 02:40:26.767+0000 [id=31]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
2021-04-24 02:40:26.784+0000 [id=33]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2021-04-24 02:40:28.098+0000 [id=33]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2021-04-24 02:40:28.104+0000 [id=37]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
2021-04-24 02:40:28.111+0000 [id=40]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2021-04-24 02:40:28.736+0000 [id=43]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
2021-04-24 02:40:28.737+0000 [id=29]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
2021-04-24 02:40:28.737+0000 [id=34]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2021-04-24 02:40:28.737+0000 [id=40]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2021-04-24 02:40:28.745+0000 [id=57]	INFO	hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
2021-04-24 02:40:28.753+0000 [id=57]	INFO	hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2021-04-24 02:40:29.052+0000 [id=40]	INFO	jenkins.install.SetupWizard#init:

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

59b1637b63a34077bf6115e9e29ae331

This may also be found at: /Users/ff/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

2021-04-24 02:40:39.412+0000 [id=41]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
2021-04-24 02:40:39.429+0000 [id=23]	INFO	hudson.WebAppMain$3#run: Jenkins is fully up and running
2021-04-24 02:40:52.501+0000 [id=57]	INFO	h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2021-04-24 02:40:52.501+0000 [id=57]	INFO	hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
2021-04-24 02:40:52.508+0000 [id=57]	INFO	hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 23,761 ms

Then copy this password, because you need to use it when logging in to Jenkins
59b1637b63a34077bf6115e9e29ae331

4. Login: http://localhost:8081/

Enter the password just copied: 59b1637b63a34077bf6115e9e29ae331

This completes the installation

Then install the plug-in. Because I'm not familiar with it, I chose to install the recommended plug-in

If the network is not good, sometimes it will fail. Install it several times more. Or 4G/5G hotspots on mobile phones will download much faster

After the plug-in is installed, create the first administrator user and save it

Finally, configure the instance and save it.

The next article documents how to run the project

"Never give up, there is always hope waiting in front!" Give it to yourself and to the bloggers who are reading the article ~

Topics: jenkins