编程知识 cdmana.com

Setting up CI / CD continuous integration environment for net framework (1) installing Jenkins on Windows Server

Preface

Most of the Internet is aimed at the mainstream Spring Cloud、NET Core Of CI/CD programme . But at present, most of the domestic companies can't simply change the project from NET Framework Switch to upgrade to NET Core, There is an urgent need to introduce CI/CD Process to improve the development experience and efficiency . therefore , This series of blogs addresses this issue , To solve NET Framework Continuous integration challenges of .

The problem

  • Complex project structure , And the solution of multiple projects is multiple source code
  • It's hard to build , In some projects, the package management is still in the way of file path reference
  • The front and rear ends are not completely separated , At present, many companies have NET project , Front end personnel and back end personnel are separated , But the source code of the project is still in the same project
  • It is difficult to automatically adjust the configuration file of a project in multiple environments . It is difficult to use the built-in multi environment configuration file syntax or to connect the current configuration center on the market
  • Deployment cannot be like NET Core The same packaging image , Push to the image management platform , And then upgrade

The whole idea

In view of the above problems , about NET Framework Project CI/CD The construction plan is very limited . The plan I chose was roughly Gitlab+Jenkins+MSbuild+Rsync

Let's introduce the division of labor and functions of these blocks :

  • GItlab: Source control 、 To configure Webhook、 The engineer submits the branch code to trigger the corresponding Jenkins Of item Mission
  • Jenkins: Responsible for managing each phase of building and deploying the continuous integration pipeline
  • MSbuild: Responsible for building NET Framework project , Generate release file
  • Rsync: Responsible for deploying the built release file to the designated server

flow chart

 Integrate media release process  (1).png

This flow chart is applicable to different branches of the same project at the front and back end , We can make corresponding changes according to the actual situation of the project 、 Of course, the main process will not change


So let's actually start building

Windows Server installation Jenkins

One 、 Download installation package

Official download address :Jenkins Installation package download address

image.png

Direct selection Windows Environmental LTS Version installation package

Two 、 install JDK

because Jenkins Need to rely on Java Environmental , So you need to install it on the server first JDK. Bloggers here directly put JDK Put the installation package here ,JDK The installation process and environment variables are configured online a lot , I won't repeat it here .

JDK Baidu network disk link Extraction code :5rpx

3、 ... and 、 install Jenkins

Simple installation , Just follow the prompts and go on to the next step

1、 Configure the account and password of the server

image.png

2、 choice Jenkins Service port

image.png

3、 To configure JDK route

image.png

4、 installation is complete ,Jenkins Will automatically open the browser for the port page ( Like my default :8080 port ). It's going to be a little bit long , It could take a dozen minutes , First go to the next step 4 to configure Jenkins Then restart the service , Otherwise, it will be initialized after restart

image.png

Four 、 To configure Jenkins

Jenkins Once installed , There will be one. Jenkins.xml The configuration file . We need to go inside and configure it Jenkins Working directory of

1、 open Jenkins Under the installation path Jenkins.xml The configuration file

image.png

2、 Configure working directory

image.png

3、 The modification is complete , Restart the service for the configuration to take effect

image.png

4、 Now Jenkins The management web page is also initialized , The installation prompt finds the password file in the specified path , Copy the password into the text box , Then click continue

image.png

5、 Click here Choose plug-ins to install , Because there are some plug-ins , We don't need , Just according to your own needs

image.png

6、 Then check the plug-in you want to install , I'll list the necessary ones below, but Jenkins Plug ins not checked by default , Then click Install and the plug-in will be installed automatically ,Jenkins Even if the installation is complete

image.png

  • MSBuild: compile NET Framework project
  • GitLab: Source control , Pull project code , Configure branch commit Webhook
  • Role-based Authorization Strategy:Jenkins Role rights management of , Assign different permissions to team members

End

So much for the first one , It mainly introduces the whole idea , Then explain how to install and configure Jenkins. In the next article, I'll explain how to configure Jenkins Of item from Gitlab Pull the code .

I expect the whole series to have 8~10 piece , The main reason is that the explanations on the Internet are scattered and rough , I want to explain it in detail , To avoid people going through some holes I met in the process of building .

版权声明
本文为[ElijahZeng]所创,转载请带上原文链接,感谢

Scroll to Top