内网部署Jenkins,并安装好所需插件
此篇内容需承接内网搭建Jenkins自动化远程部署项目到Windows服务器_jenkins内网安装-CSDN博客
,才更好操作与理解
- #!/bin/sh -l
- git checkout $tag
- dotnet restore
- dotnet build
- dotnet publish "/root/.jenkins/workspace/xxx/services/host/xxx.Host" -c JKdeploy
- echo "开始打包成一个文件"
- tar -cvf publish.tar services/host/xxx.Host/bin/JKdeploy/net6.0/publish/
- @echo off
-
- set BUILD_ID=DONTKILLME
- set port=44315
- for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do taskkill /pid %%m -t -f
-
- setlocal
-
- REM Setting environment variables
- set "tarFile=D:\QIU\jenkins_ci_cd\xxx\publish.tar"
- set "extractFolder=D:\QIU\jenkins_ci_cd\xxx"
-
- REM Download and unzip tar
- tar -xf %tarFile% -C %extractFolder%
-
- REM Check whether the decompression is successful
- if errorlevel 1 (
- echo Decompression failure
- exit /b 1
- )
-
- REM Run DLL file
- cd /d %extractFolder%\services\host\xxx.Host\bin\JKdeploy\net6.0\publish
- dotnet xxx.Host.dll --urls "http://x.x.x.x:44315" --environment JKdeploy
-
- endlocal