Continuous integration based on jenkins

Using jenkins to achieve the goal:

  • After the SVN content is changed, the code can be automatically updated by SVN to the continuous integration server, or the build can be performed manually.
  • In the continuous integration server, the project is automatically built; after the build is completed, it is automatically deployed to the server.
  • The process log for each build can be viewed.
  • If the build and deployment process fails or succeeds, an email reminder needs to be sent.
  • Set the account and password, only the person in charge of continuous integration can build.

Implementation process:

  • Deploy jenkins. Download the jenkins deployment package at  https://jenkins.io/index.html; after the download is complete, put jenkins.war in tomcat to run.
  • Note: The working directory of jenkins defaults to the working directory of the current system login user, and the related jenkins configuration and downloaded code will be stored in the working directory. You can change the working directory by setting system environment variables, as shown below.
  •  Install the jenkins plugin. Select System Management -> Plugin Management. The main installed plugins include version management plugins (Subversion Plug-in, CVS Plug-in), email sending (Email Extension Plugin), maven (Maven Integration plugin), and SSH (Publish Over SSH). After the installation is complete, restart tomcat.
  • Configure the mail service. Select System Management -> System Settings, set up emails as shown below, and execute the email sending test after the settings are complete.


     Note: The firewall of the continuous integration server must allow the smtp port. For example, the smtp port of QQ mailbox is 465.
     
  • Configure the SSH server. The reference configuration is as follows.

     
  • Configure JOB . Create a new JOB and set a name, such as JF. The main configuration contents include: SVN checkout URL and account, SCM build trigger cycle, email reminder, maven build command, SSH file transfer, and SSH-based remote server control. There is no specific explanation for each item, and there is a corresponding explanation after each input item. The reference configuration is as follows:



      

     

     

     
  • Build log. The build process starts from 1 and increases by 1 each time. You can view the log of each build process by clicking "Console Output". Reference is below.

     
     Note: The function of setting the quiet period is: after detecting the SVN update, you can wait for a period of time before executing the build, reducing the problems caused by the incomplete SVN update code.

     
question:
  • If snapshot is used in the project version, you need to specify the update strategy of snapshot in maven's settings.xml, otherwise the problem of snapshot not being updated may occur.

     

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326229950&siteId=291194637