jenkins自动化部署工具,部署在linux下面的话对.net core来说没有问题,只需要部署.net core linuxSDK就能自动化部署了,但是却无法自动化部署net framework项目,下面我们就来部署在Windows下面。
安装环境与软件准备
准备工作
系统:Windows Server 2019 DataCenter
硬件配置:E5 2630L V4、32GB RAM、220GB SSD(RAID1)
软件:
①:jenkins Windows 安装包 下载地址
②:JDK 11 下载地址
安装步骤
1:JDK安装注意事项
首先安装JDK,安装好以后记住安装路径,待会要用,我的路径是D:\Program Files\Java\jdk-11.0.8\bin\java.exe
2:jenkins安装与配置
一定要一个管理员账号登陆,不要选择第一项LocalSystem。
配置,打开位于安装目录下面jenkins.xml配置文件
<!--
The MIT License
Copyright (c) 2004-2017, Sun Microsystems, Inc., Kohsuke Kawaguchi, Oleg Nenashev, and other Jenkins contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Windows service definition for Jenkins.
To uninstall, run "jenkins.exe stop" to stop the service, then "jenkins.exe uninstall" to uninstall the service.
Both commands don't produce any output if the execution is successful.
-->
<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins automation server.</description>
<env name="JENKINS_HOME" value="D:\Program Files\Jenkins\data"/><!--配置Jenkins的工作数据目录-->
<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<executable>D:\Program Files\Java\jdk-11.0.8\bin\java.exe</executable><!--配置JAVA的路径,刚刚我们记下来的目录-->
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "D:\Program Files\Jenkins\jenkins.war" --httpPort=-1 --httpsPort=7070 --httpsKeyStore="%BASE%\secrets\***.pfx" --httpsKeyStorePassword=*** --webroot="%LocalAppData%\Jenkinswar"</arguments>
<!--配置运行参数,--httpPort为http端口,这里我们禁用就是-1,-httpsPort开启https访问,--httpsKeyStore指定证书路径,--httpsKeyStorePassword=证书密码,证书名称要和域名一致
-->
<!--
interactive flag causes the empty black Java window to be displayed.
I'm still debugging this.
<interactive />
-->
<logmode>rotate</logmode>
<onfailure action="restart"/>
<!--
In the case WinSW gets terminated and leaks the process, we want to abort
these runaway JAR processes on startup to prevent corruption of JENKINS_HOME.
So this extension is enabled by default.
-->
<extensions>
<!-- This is a sample configuration for the RunawayProcessKiller extension. -->
<extension enabled="true" className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension" id="killOnStartup">
<pidfile>%LocalAppData%\Jenkinsjenkins.pid</pidfile>
<stopTimeout>10000</stopTimeout>
<stopParentFirst>false</stopParentFirst>
</extension>
</extensions>
<!-- See the referenced examples for more options -->
</service>
文章评论