Jenkins deploys .net platform to automate builds

  When introducing automated deployment tools, we compared jenkins and gitlab CI. Jenkins has very rich plug-ins, which are easy to configure. gitlab CI is more inclined to script configuration, of course, jenkins can also use pipline to achieve fully scripted configuration (everything is code, haha). Here we mainly talk about the automated deployment of jenkins.

The basic combination is jenkins+git+msbuild+python, which implements pulling, compiling, packaging, deploying, and automated testing from the code repository. (.net core and framework4.6.1 can be built without msbuild, which will be described in the next article)

1. Installation environment

   1. Jenkins is a product of the java ecosystem and needs to install jdk

   2. The .net project depends on the .net framework, install the required framework version (such as framework4.5.1)

   3. Install the build tool msbuild

   4. Install nuget

   5. Install jenkins

Second, configure jenkins

  1. After installing jenkins, go to "System Management" -> "Plugin Management" to install git and msbuild plugins.

 

  

  2. After installing the plug-in, create a new project, select "Build a free-style software project" , and then click OK.

 

  3. Select git for source code management .

  

 

  4. Add a build step to build a project

 

  5. If the project needs nuget to obtain the package, it can be achieved using batch processing , and continue to add build steps:

 

  6. The nuget restore command obtains the required packages for the project

 

Rebulid: Build

Configuration=Release: package by release

DeployOnBuild = true/false: whether to package

PublishProfile=pub100: pub100 is the configuration file packaged by VS

 

Note: The Msbuild Version here is selected from vs2017. The msbuild version in the jenkins plugin library is too low, and compilation errors often occur. The easiest way is to install VS, and then configure VS in "System Management" -> "Global Tool Configuration" msbuild path in tools

 

 

 

 

7. Build triggers, jenkins provides timing construction and polling mechanisms. Polling is to set a period of time, go to the code repository to check whether there is an update, and an update triggers the build .

 

 

8. Save, select "Build Now"

 

 

 

9. Build success

 

10. Console log

 

The deployment server and automated tests are all implemented by python. If you are interested, you can read my other article.

 

Guess you like

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