Make sure you have the Java environment on your server along with the Maven environment and Git

Install Jenkins

IO /zh/doc/

IO/en /download…

The best way to do this is to download the Jenkins Jar package yourself, just like running the Jar package

nohup java -jar jenkins.war --httpPort=80
Copy the code

Access directly.

After successfully starting the service, it should look like this:

Login Password:

cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the code

I chose the recommended plugin directly:

Jenkins automatic build

Original reference: Jenkins Builds Automatically

When we submit code to GitHub, we can perform the build on Jenkins, but it is a little difficult to do it every time. Today we will test Jenkins’ automatic build function, and every time we submit code to GitHub, Jenkins will automatically build!

Pay attention to the point

GitHub will take the initiative to notify Jenkins after receiving the submitted code, so Jenkins’ server must have an external IP, otherwise GitHub cannot access it. My Jenkins server is deployed on the cloud host of Tencent Cloud with an external IP.

The whole process

  • GitHub to prepare a Spring Boot web project;
  • Configure Jenkins’ Webhook address on GitHub;
  • Create an Access token on GitHub. Jenkins will use this access token to authenticate some operations that require permission.
  • Jenkins install GitHub Plugin;
  • Jenkins configure GitHub access permission;
  • Create a build project on Jenkins with the corresponding source code for the Web Project in Step 1.
  • Modify the source code of the Web project, and submit it to GitHub;
  • Check whether Jenkins’ build project is triggered to automatically build. After successful build, download the project and run it to see if it is built based on the latest code