当前位置:网站首页>Set up CI server with Jenkins
Set up CI server with Jenkins
2022-07-24 12:36:00 【Brother Xing plays with the clouds】
Jenkins It's an open source, cross platform CI Tools , It can be deployed in Windows、Linux Platforms such as , also Jenkins Provides a very rich set of plug-ins to help complete the compilation 、 test 、 Deployment, etc . This article will introduce you to Windows On the platform Jenkins complete .Net Core Build a continuous integration environment for applications , The main contents are as follows :
- Jenkins Download and install
- Create a .Net Core Compilation task
- Realize automatic test
- Implement automatic deployment
- Summary
Jenkins Download and install
This example USES Jenkins2.136 Version to demonstrate ,Jenkins Download address :https://jenkins.io/download/ 1. download Jenkins Of Windows Installers :
2. Complete the installation wizard Jenkins install :
Jenkins The default port is 8080, When the installation is completed, you can access... Through this port Jenkins:
3. according to Jenkins The configuration wizard completes the corresponding configuration , And enter Jenkins: Select common plug-ins , These plug-ins contain Git、SVN And other common plug-ins :
Create user :
Get into Jenkins:
Create a .Net Core Compilation task
1. Create a new task :
Fill in the task name and choose a free style project :
2. Modify task configuration :
The code base :
3. Add build steps , Here to perform dotnet The compile command of :
4. Perform tasks , The output is as follows :
Realize automatic test
1. Add test run steps :
dotnet Test command reference :https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test?tabs=netcore21 Running results :
2. Collect code coverage : The use of OpenCover To analyze .net core Unit test code coverage , And then through ReportGenerator To generate Html Report in format , So first, you need to add the construction steps of code coverage analysis and report generation :
OpenCover.Console.exe -target:"dotnet.exe" -targetargs:"test XUnitTestProject/XUnitTestProject.csproj" -output:coverage.xml -filter:"+[*]* -[*Moq]* -[xunit*]*" -oldstyle ReportGenerator.exe "-reports:coverage.xml" "-targetdir:report" notes : Use... In continuous integration tools OpenCover Code override information may not be generated , So you need to OpenCover.Profiler.dll File registration , The registration code is as follows :
OpenCover.Profiler.dll The file is located in OpenCover Installation directory , For more details OpenCover Install under directory Usage.rtf file .
If you want to generate Html stay Jenkins Displayed on the , Then you must add a HTML Publisher Plug in for :
Then add... In the post build operation HTML Publish operation :
Need to fill in HTML Table of contents and report start page . Save the configuration when you're done , And build :
Then you can view the code coverage report in the engineering panel :
The report :
Implement automatic deployment
When the compilation is complete , You need to publish the compiled results , For one Windows For console applications , In fact, the edited execution program and related assemblies can be published , And this program file is actually in the project bin Under the table of contents . stay Jenkins Through Artifact Deployer Plug-in This plug-in to complete the file publishing function :
When the plug-in is installed , Add a deployment operation to the post build operation of the project , Copy the generated file to D:\test Under the table of contents :
After the build is executed, the build results will be automatically published to D:\test Under the table of contents .
Summary
This article briefly introduces how to use Jenkins And related plug-ins .Net Core Automatic compilation of programs 、 Test and release features . Whether using various hosting tools mentioned in the previous article or building your own Jenkins Its core steps are completed by executing commands through corresponding tools ( Compile command 、 The test command 、 Code coverage command 、 Report generation commands, etc ).
Although all through the same tools and the same commands , But different CI There are still some differences in the use of tools , And there are a lot of manual configurations , Is there a way to simplify and reuse CI/CD How about the process ? Please look forward to the following (*^_^*)
边栏推荐
猜你喜欢

Okaleido tiger NFT is about to log in to binance NFT platform

Okaleido tiger NFT即将登录Binance NFT平台

C Advanced - data storage

Aruba learning notes 04 Web UI -- Introduction to configuration panel

Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator

ThinkPHP realizes database backup

SQL multi condition query cannot be implemented

国产旗舰手机定价近六千,却连iPhone12都打不过,用户选谁很明确

C language course design -- hotel management system

How to realize the function of grabbing red envelopes in IM system?
随机推荐
以Chef和Ansible为例快速入门服务器配置
Oceanbase Database Setup Test
TypeNameExtractor could not be found
[rust] what software should I use to develop rust? Recommended editors commonly used to support rust
nacos部署
Error: [synth 8-439] module 'xxx' not found not found error solution
Qt Creator怎样更改默认构建目录
元宇宙更多的功能和作用在于对于传统生活方式和生产方式的深度改造
VMware virtual machine and vSphere migrate to each other
Buckle exercise - 32 divided into k equal subsets
Why has API strategy become a magic weapon for enterprises' digital transformation?
Most after analyze table in PostgreSQL_ common_ Why is the elems field not filled in?
Say no to blackmail virus, it's time to reshape data protection strategy
Is it safe to contact the account manager online to open a fund account?
How to render millions of 2D objects smoothly with webgpu?
Reserved instances & Savings Plans
QT notes - EventFilter event filter
iSCSI新应用,以及NFS的存储服务分离
做自媒体视频剪辑有免费可商用的素材网站吗?
我在一个模块工程中使用注解配置了redis的序列化, 然后在另外一个模块引入这个模块,为什么这个配置