首页 > 其他分享 >Jenkins Pipeline 记录

Jenkins Pipeline 记录

时间:2024-04-01 13:59:15浏览次数:20  
标签:Rena Pipeline mrsrc Package Demo 记录 install Path Jenkins

pipeline {
agent { //确认任务执行的节点可以是 any 任何节点 none 不选择节点
label '150'
}
options { //设置参数
timeout(time: 4, unit: 'HOURS') //超时时间1小时,如果不加unit参数默认为1分
buildDiscarder(logRotator(numToKeepStr: '5')) //保留三个历史构建版本
disableConcurrentBuilds() //只能运行一个构建
}
triggers{
pollSCM("H/30 * * * ") //轮询代码变更
}
stages {
stage('check svn'){
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo"
}
}
steps() {
script{ //脚本块
scmVars = checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'wujh', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'https://192.168.87.231/svn/SeqFw/branches/RENA2_INTEGRATION']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
echo "${scmVars.SVN_REVISION}" //获得svn更新号
script
{
env.VAR1 = scmVars.SVN_REVISION // 脚本式创建一个环境变量
}
}
}
}
stage('check svn for product'){
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo_Product"
}
}
steps() {
script{
url = 'https://192.168.87.231/svn/SeqFw/branches/RENA2_INTEGRATION@' + env.VAR1
echo "${url}"
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'wujh', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: url]], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
}
}
}
stage('build'){
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo"
}
}
steps()
{
echo "VAR1 = ${env.VAR1}"
powershell '''Remove-Item -Recurse -Force "E:\ImageData" -ErrorAction SilentlyContinue
$7ZipExe = "C:\Program Files\7-Zip\7z.exe"
$SoftwareVersion = $SoftwareVersion = "1.1.0."
$today=Get-Date
$formatDate = $today.ToString('yyyy-MM-dd')
$currentVersion = $SoftwareVersion + $env:VAR1 + "000"
Write-Output ( $currentVersion)
Remove-Item "mrsrc\interfaces\include\version.inc"
Set-Content "mrsrc\interfaces\include\version.inc" """$currentVersion"",""$formatDate"""
if (Test-Path "X:\CSharpLibrary\Infra")
{
Remove-Item "X:\CSharpLibrary\Infra" -Recurse -Force
}'''
bat '''call D:\Jekins\PlatForm_HAN\mapdrv.vbs
call mrsrc\tools\KillSystem.bat
python "D:\jekins\Rena_Demo\mrsrc\src\Apps\Tooling\src\SystemErrorCodeScript\src\ExcelToXml\Transfer.py" "D:\jekins\Rena_Demo\mrsrc\src\Apps\FieldService\doc\Component Error Code Definition.xlsx" "D:\jekins\Rena_Demo\mrsrc\interfaces\appdata\T30\workflow\config\RemoteConfigure.xml"
python "D:\jekins\Rena_Demo\mrsrc\src\Apps\Tooling\src\SystemErrorCodeScript\src\ExcelToXml\Transfer.py" "D:\jekins\Rena_Demo\mrsrc\src\Apps\FieldService\doc\Component Error Code Definition.xlsx" "D:\jekins\Rena_Demo\mrsrc\interfaces\appdata\T15\workflow\config\RemoteConfigure.xml"
del /f /s /q Setup\Package
rmdir /s /q Setup\Package\appdata
rmdir /s /q Setup\Package\VxWorks
rmdir /s /q Setup\Package\userdata
rmdir /s /q Setup\Package\tools
rmdir /s /q Setup\Package\NeubinSetup
rmdir /s /q Setup\Package\WindowsNative
rmdir /s /q Setup\Package\WindowsFSA
del /f /s /q mrsrc\postprocessing
rmdir /s /q mrsrc\postprocessing
del /f /s /q mrsrc\CSI
rmdir /s /q mrsrc\CSI
echo "start to delete build folder"
del /f /s /q mrsrc\build
rmdir /s /q mrsrc\build
echo "start to clean install folder"
del /f /s /q mrsrc\install
rmdir /s /q mrsrc\install
del /f /s /q mrsrc\src\Platform\ThriftDef\gen-csharp
rmdir /s /q mrsrc\src\Platform\ThriftDef\gen-csharp
echo "end to clean install folder"
echo "start to clean release vxworks"
call mrsrc\tools\build.bat -p vxworks -c release -t clean
echo "start to clean release windows"
call mrsrc\tools\build.bat -p windows -c release -t clean
echo "start to build release vxworks"
cd mrsrc\tools
echo "build release vxworks"
call build.bat -p vxworks -c release -t build'''
powershell '''$path = $ENV:WORKSPACE
Write-Output ( $path)
$cmakePath = Join-Path $path "mrsrc\build\vxworks_release\CMakeFiles\CMakeError.log"
if((Test-Path $cmakePath))
{
$LastExitCode = 1
exit $LastExitCode
}
$fullPath = Join-Path $path "mrsrc\build\vxworks_release\"
$fileList = Get-ChildItem $fullPath -recurse SCU_vxworks_release_build
.log | %{$.FullName}
Foreach($file in $fileList)
{
if($file.Contains("SCU_vxworks_release_build"))
{
$tmpContent = Get-Content $file
if($tmpContent[$tmpContent.length -1].Contains("failed"))
{
$LastExitCode = 1
}
else
{
$LastExitCode = 0
}
}
}
if(Test-Path "mrsrc\CMakeLists_BAK.txt")
{
Remove-Item "mrsrc\CMakeLists_BAK.txt"
if(Test-Path "mrsrc\CMakeLists.txt")
{
Remove-Item "mrsrc\CMakeLists.txt"
}
}
$timeOutDay = 2
$filePath = "D:\Logs\MR"
$allFile = Get-ChildItem -Path $filePath
foreach($file in $allFile)
{
if (test-path $file)
{
$daySpan = ((Get-Date) - $file.LastWriteTime).Days
if ($daySpan -gt $timeOutDay)
{
Remove-Item $file.FullName -Recurse -Force
}
}
}
exit $LastExitCode'''
bat '''echo "start to build release windows"
rmdir /s /q mrsrc\build\windows_releas
del /f /s /q mrsrc\build\windows_release
cd mrsrc\tools
call build.bat -p windows -c release -e vicp -t build -j 8'''
bat '''echo "start to build release windows"
cd mrsrc\tools
call build.bat -p windows -c release -t build'''
bat '''echo "start to Test Platform"
rmdir /s /q mrsrc\build\windows_release
del /f /s /q mrsrc\build\windows_release
cd mrsrc\tools
call launch_testplatform_build.bat'''
bat '''cd mrsrc\install\WindowsNative\Release
copy device.exe device_mini.exe /y'''
bat '''echo "start to build csharp release windows"
rmdir /s /q X:\CSharpLibrary\Infra
del /f /s /q X:\CSharpLibrary\Infra
cd mrsrc\tools
call HanApplication_Build.bat 1'''
powershell '''cd mrsrc\src\Apps\Application\src
&"C:\Program Files (x86)\Sisulizer 4\SlMake.exe" create .\Application.slp
Remove-Item .\Application.slp
if((Test-Path ".\Application.~slp"))
{
Remove-Item .\Application.~slp
}'''
powershell '''cd mrsrc\src\Apps\VICPApplication\src
&"C:\Program Files (x86)\Sisulizer 4\SlMake.exe" create .\VICPApplication.slp
Remove-Item .\VICPApplication.slp
if((Test-Path ".\VICPApplication.~slp"))
{
Remove-Item .\VICPApplication.~slp
}'''
bat '''echo "start to build csi release windows"
rmdir /s /q AVWPost\build
del /f /s /q AVWPost\build
rmdir /s /q AVWPost\install
del /f /s /q AVWPost\install
rmdir /s /q AVWPost\publish
del /f /s /q AVWPost\publish
cd AVWPost\tools
call generate_vs_project_release_for_neumrpost.bat'''
bat '''echo "start to build csi release windows"
xcopy D:\jekins\Rena_Demo\AVWPost\install\Release\CSIPostprocess\bin\CSIPostprocess.dll AVWPost\Interface\library\csi\WindowsNative\Release\CSIpostprocess.dll /y /e
xcopy D:\jekins\Rena_Demo\AVWPost\install\Release\CSIPostprocess\lib\CSIPostprocess.lib AVWPost\Interface\library\csi\WindowsNative\Release\CSIpostprocess.lib /y /e
xcopy D:\jekins\Rena_Demo\AVWPost\install\Release\CSIPostprocess\bin\CSIPostprocess.pdb AVWPost\Interface\library\csi\WindowsNative\Release\CSIpostprocess.pdb /y /e
cd AVWPost\src\Tools
call build.bat 1'''
powershell 'python D:\jekins\Rena_Demo\buildPython\SaveRunAllDepence.py'
}
}
stage('copy install To Shared disk'){
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo"
}
}
steps()
{
powershell '''Remove-Item -Recurse -Force "D:\Jekins\Rena_Demo_Install" -ErrorAction SilentlyContinue
copy-item D:\Jekins\Rena_Demo\mrsrc\install D:\Jekins\Rena_Demo_Install\install -Recurse -Force
copy-item D:\Jekins\Rena_Demo\mrsrc\tools\UnitTest.bat D:\Jekins\Rena_Demo_Install\install\
copy-item D:\jekins\Rena_Demo\buildPython\ChangeT15.py D:\Jekins\Rena_Demo_Install\install\
$7ZipExe = "C:\Program Files\7-Zip\7z.exe"
&"$7ZipExe" a D:\Jekins\Rena_Demo_Install\install.zip D:\Jekins\Rena_Demo_Install
net use * /del /y
$net = New-Object -com WScript.Network
$drive = "Y:"
$path = "\\10.22.33.10\SWPackage\Ut\Rena_Demo"
$net.mapnetworkdrive($drive, $path, $true, "wujh","123456")
copy-item D:\Jekins\Rena_Demo_Install\.zip D:\jekins\Rena_Demo
Move-Item D:\Jekins\Rena_Demo_Install\
.zip $path'''
archiveArtifacts artifacts: 'install.zip'
powershell '''remove-item D:\jekins\Rena_Demo\install.zip'''
}
}
stage('pack'){
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo"
}
}
steps()
{
powershell '''if (Test-Path D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\Logger.dll)
{
Remove-Item D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\Logger.dll
}
if (Test-Path D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\LogCenter.dll)
{
Remove-Item D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\LogCenter.dll
}
if (Test-Path D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\Utils.dll)
{
Remove-Item D:\jekins\Rena_Demo\mrsrc\install\WindowsFSA\Release\Utils.dll
}'''
powershell '''cd $ENV:WORKSPACE
Write-Output ( $ENV:WORKSPACE)
if ((Test-Path "mrsrc\postprocessing") -eq $false)
{
New-Item -Path 'mrsrc\postprocessing' -ItemType Directory
}
Copy-Item "AVWPost\install\Release\MRSProject\bin\MRSProject.dll" -Destination "mrsrc\postprocessing\MRSProject.dll"
Copy-Item "AVWPost\install\Release\DCEPostprocess\bin\DCEPostprocess.dll" -Destination "mrsrc\postprocessing\DCEPostprocess.dll"
Copy-Item "AVWPost\install\Release\PostERUP\PostERUP.dll" -Destination "mrsrc\postprocessing\PostERUP.dll"
Copy-Item "AVWPost\install\Release\SaveData\SaveData.dll" -Destination "mrsrc\postprocessing\SaveData.dll"
Copy-Item "AVWPost\install\Release\SmartArray\SmartArray.dll" -Destination "mrsrc\postprocessing\SmartArray.dll"
Copy-Item "AVWPost\install\Release\Test_DCEprocDLL\bin\Test_DCEprocDLL.dll" -Destination "mrsrc\postprocessing\Test_DCEprocDLL.dll"
Copy-Item "AVWPost\ThirdParty\CompLog\bin\CompLog.dll" -Destination "mrsrc\postprocessing\CompLog.dll"
Copy-Item "AVWPost\install\Release\MRSProject\lib\MRSProject.lib" -Destination "mrsrc\postprocessing\MRSProject.lib"
Copy-Item "AVWPost\install\Release\DCEPostprocess\lib\DCEPostprocess.lib" -Destination "mrsrc\postprocessing\DCEPostprocess.lib"
Copy-Item "AVWPost\install\Release\PostERUP\PostERUP.lib" -Destination "mrsrc\postprocessing\PostERUP.lib"
Copy-Item "AVWPost\install\Release\SaveData\SaveData.lib" -Destination "mrsrc\postprocessing\SaveData.lib"
Copy-Item "AVWPost\install\Release\SmartArray\SmartArray.lib" -Destination "mrsrc\postprocessing\SmartArray.lib"
Copy-Item "AVWPost\install\Release\Test_DCEprocDLL\lib\Test_DCEprocDLL.lib" -Destination "mrsrc\postprocessing\Test_DCEprocDLL.lib"
Copy-Item "AVWPost\ThirdParty\CompLog\lib\CompLog.lib" -Destination "mrsrc\postprocessing\CompLog.lib"
Copy-Item "AVWPost\install\Release\MRSProject\bin\MRSProject.pdb" -Destination "mrsrc\postprocessing\MRSProject.pdb"
Copy-Item "AVWPost\install\Release\DCEPostprocess\bin\DCEPostprocess.pdb" -Destination "mrsrc\postprocessing\DCEPostprocess.pdb"
Copy-Item "AVWPost\install\Release\PostERUP\PostERUP.pdb" -Destination "mrsrc\postprocessing\PostERUP.pdb"
Copy-Item "AVWPost\install\Release\SaveData\SaveData.pdb" -Destination "mrsrc\postprocessing\SaveData.pdb"
Copy-Item "AVWPost\install\Release\SmartArray\SmartArray.pdb" -Destination "mrsrc\postprocessing\SmartArray.pdb"
Copy-Item "AVWPost\install\Release\Test_DCEprocDLL\bin\Test_DCEprocDLL.pdb" -Destination "mrsrc\postprocessing\Test_DCEprocDLL.pdb"'''
powershell 'python D:\jekins\Rena_Demo\buildPython\ChangeSimulateFalse.py'
bat '''del /q /s mrsrc\install\userdata\temp\.
del /q /s mrsrc\install\WindowsNative\Release\.dump
del /q /s /f mrsrc\install\userdata\imagedata
rmdir /s /q mrsrc\install\userdata\imagedata
cd Setup
echo "start clean folder"
del /f /s /q Package
rmdir /s /q Package\NeubinSetup
del /f /s /q ..\mrsrc\WindowsTP
rmdir /s /q ..\mrsrc\WindowsTP
xcopy ClinicalScripts %cd% /y /e
xcopy ..\mrsrc\tools\Scripts ..\mrsrc\install\tools /y /e
copy ..\mrsrc\install\TestPlatform_Installer.exe Package\TestPlatform_Installer.exe /y
xcopy ..\ThridParty\HubSim ..\mrsrc\install\tools\HubSim\ /y /e /d
copy ..\mrsrc\src\Apps\Tooling\src\SystemErrorCodeScript\output\ErrorCodeConfiguration.exe ..\mrsrc\install\tools\ErrorCodeConfiguration.exe /y
xcopy ..\ThridParty\Firmware ..\mrsrc\install\appdata\T30\SCU\firmware\ /y /e /d
xcopy ..\ThridParty\Firmware ..\mrsrc\install\appdata\T15\SCU\firmware\ /y /e /d
xcopy ..\ThridParty\FileCheck ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\FileCheck\ /y /e /d
xcopy ..\ThridParty\Cleaner ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\Cleaner\ /y /e
IF %ERRORLEVEL% LEQ 1 echo "Clean complete...."
echo "Start to generate wxs file..."
xcopy ..\mrsrc\install\WindowsTP ..\mrsrc\WindowsTP\ /y /e /d
del /f /s /q ..\mrsrc\install\WindowsTP
rmdir /s /q ..\mrsrc\install\WindowsTP
NeuBinInstall.exe NMS
cd ..\ThridParty\FileCheck
call NMS.MR.FileChcekUpload.exe D:\jekins\Rena_Demo\Setup\Package\NeubinSetup\NMS\NeuBin
cd ..\..\Setup
xcopy ..\ThridParty\FileCheck ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\FileCheck\ /y /e /d
dir /s/b
echo "End to generate wxs file..."
echo "Start to generate WixObj file..."
"X:\WiX Toolset v3.11\bin\candle.exe" -dDev=%cd%\Package\NeubinSetup\ Package.wxs
echo "End to generate WixObj file..."
echo "Start to generate MSI file..."
"X:\WiX Toolset v3.11\bin\light.exe" Package.wixobj -out Package\\NeubinSetup\\Scanner\\NeuBin.msi
echo "End to generate MSI file..."
del WixProj.xml
del Package.wixobj
xcopy ..\mrsrc\install\WindowsExt\Release Package\NeubinSetup\WindowsExt\bin\ /y /e /d
xcopy ..\mrsrc\install\WindowsVICP\Release Package\NeubinSetup\WindowsVICP\bin\ /y /e /d
copy ..\mrsrc\install\version.inc Package\NeubinSetup\WindowsVICP\bin\version.inc /y
xcopy VICPScripts %cd% /y /e
echo "Start to package..."
del /f /q /a Package\NeubinSetup\WindowsVICP\bin\
.lib
del /f /q /a Package\NeubinSetup\WindowsVICP\bin\.pdb
echo "Start to generate wxs file..."
NeuVICP.exe
echo "End to generate wxs file..."
echo "Start to generate WixObj file..."
"X:\WiX Toolset v3.11\bin\candle.exe" -dDev=%cd%\Package\NeubinSetup\WindowsVICP\bin\ Package.wxs
echo "End to generate WixObj file..."
echo "Start to generate MSI file..."
"X:\WiX Toolset v3.11\bin\light.exe" Package.wixobj -out Package\\NeubinSetup\\VICP\\VICP.msi
echo "End to generate MSI file..."
del WixProj.xml
del Package.wixobj
del /f /s /q Package\NeubinSetup\VICP\VICP.wixpdb
copy ..\mrsrc\install\version.inc Package\NeubinSetup\VICP\version.inc /y
copy ..\mrsrc\install\version.inc Package\NeubinSetup\version.inc /y
xcopy X:\logserver2019 Package\NeubinSetup\MRLogServer /s/y/i/f
call "X:\InstallScript\NSIS\Software\Bin\makensis.exe" X:\InstallScript\NSIS\NeuMRInstallerScript\NeuMRInstaller.nsi
xcopy X:\InstallScript\HanScript\
.* Package\NeubinSetup\ /s/y/i/f
del /f /s /q Package\NeubinSetup\Scanner\NeuBin.wixpdb
rd /s /q Package\NeubinSetup\NMS
rd /s /q Package\NeubinSetup\Config
rd /s /q Package\NeubinSetup\WindowsExt
rd /s /q Package\NeubinSetup\WindowsVICP
del /F /S /Q ..\mrsrc\interfaces\include\version.inc'''
powershell '''$currentFolder = $ENV:WORKSPACE
Write-Output ($currentFolder)
$avwFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\AVW"
$qtfile = Join-Path $currentFolder "Setup\\Package\\TestPlatform_Installer.exe"
$avwsrcFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\AVW\Installation\AVW\"
Copy-Item -Path $avwsrcFolder -Destination $avwFolder -Force -Recurse
Get-ChildItem -Recurse $avwFolder -Include ".svn" | Where-Object { $
-is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force
$multiScreenFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\MultiScreenAVWConfig\"
$thirdPartyFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\ThirdParty"
Copy-Item -Path $multiScreenFolder -Destination $thirdPartyFolder -Force -Recurse
Copy-Item $qtfile -Destination $thirdPartyFolder -Force
Get-ChildItem -Recurse $thirdPartyFolder -Include ".svn" | Where-Object { $_ -is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force
$nsaFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\NSA"
$nsasrcFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\NSA\NSA\"
Copy-Item -Path $nsasrcFolder -Destination $nsaFolder -Force -Recurse
$csiConfigSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\config\\CSI"
$csiResourceSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\config\\Resource"
$csibinSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\bin"
$csiconfigDst = Join-Path $thirdPartyFolder "CSI\\config"
$csiResourceDst = Join-Path $thirdPartyFolder "CSI\\Resource"
$csibinDst = Join-Path $thirdPartyFolder "CSI\\bin"
if ((Test-Path "D:\jekins\Rena_Demo\mrsrc\CSI") -eq $false)
{
New-Item -Path 'D:\jekins\Rena_Demo\mrsrc\CSI' -ItemType Directory
}
$csiconfigCsi = Join-Path $currentFolder "mrsrc\\CSI\\config"
$csiResourceCsi = Join-Path $currentFolder "mrsrc\\CSI\\Resource"
$csibinCsi = Join-Path $currentFolder "mrsrc\\CSI\\bin"
Copy-Item -Path $csiConfigSrc -Destination $csiconfigCsi -Force -Recurse
Copy-Item -Path $csiResourceSrc -Destination $csiResourceCsi -Force -Recurse
Copy-Item -Path $csibinSrc -Destination $csibinCsi -Force -Recurse
Copy-Item -Path $csiConfigSrc -Destination $csiconfigDst -Force -Recurse
Copy-Item -Path $csibinSrc -Destination $csibinDst -Force -Recurse
Copy-Item -Path $csiResourceSrc -Destination $csiResourceDst -Force -Recurse
Get-ChildItem -Recurse $nsaFolder -Include ".svn" | Where-Object { $_ -is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force'''
powershell 'python D:\jekins\Rena_Demo\buildPython\Patchlist.py'
powershell '''$7ZipExe = "C:\Program Files\7-Zip\7z.exe"
$ScriptFolder = $ENV:WORKSPACE
Write-Output ($ScriptFolder)
$SetupSourceFile = Join-Path $ScriptFolder "\Setup\Package\NeubinSetup\"
$zipFolder = Join-Path $ScriptFolder "\Setup\Package\"
$currentTime = (Get-Date).ToString('yyyyMMdd_HHmmss')
Copy-Item -Path "D:\Jekins\GPU\CUDA_version.inc" $zipFolder
$CUDA_version = "D:\jekins\Rena_Demo\Setup\Package\CUDA_version.inc"
$SoftwareVersion = "1.1.0."
$currentVersion = $SoftwareVersion + $env:VAR1 + "000"
$SetupZipFileName = $currentVersion + "" + $currentTime + ".zip"
$destinationFile = Join-Path $zipFolder $SetupZipFileName
cd $zipFolder
if([System.IO.Directory]::Exists($SetupSourceFile)){
&"$7ZipExe" a $destinationFile $SetupSourceFile $CUDA_version
}
$windowTp = Join-Path $ScriptFolder "\mrsrc\WindowsTP\"
$windowTpFileName = $currentVersion + "_windowTp" + "
" + $currentTime + ".zip"
$windowTpFile = Join-Path $zipFolder $windowTpFileName
if([System.IO.Directory]::Exists($windowTp)){
&"$7ZipExe" a $windowTpFile $windowTp
}
$postprocessing = Join-Path $ScriptFolder "\mrsrc\postprocessing\"
$postprocessingFileName = $currentVersion + "postprocessing" + "" + $currentTime + ".zip"
$postprocessingFile = Join-Path $zipFolder $postprocessingFileName
if([System.IO.Directory]::Exists($postprocessing)){
&"$7ZipExe" a $postprocessingFile $postprocessing
}
$csi = Join-Path $ScriptFolder "\mrsrc\csi\"
$csiFileName = $currentVersion + "_csi" + "
" + $currentTime + ".zip"
$csiFile = Join-Path $zipFolder $csiFileName
if([System.IO.Directory]::Exists($csi)){
&"$7ZipExe" a $csiFile $csi
}
Remove-Item -Recurse -Force "D:\jekins\Rena_Demo_Product\mrsrc\install" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "D:\jekins\Rena_Demo_Product\AVWPost\publish" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "D:\jekins\Rena_Demo_Product\mrsrc\WindowsTP" -ErrorAction SilentlyContinue
Get-ChildItem -Recurse "D:\jekins\Rena_Demo\mrsrc\install" -Include ".svn" | Where-Object { $
-is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force
Copy-Item -Path "D:\jekins\Rena_Demo\mrsrc\install" -Destination "D:\jekins\Rena_Demo_Product\mrsrc\install" -Recurse -Force -Verbose
Copy-Item -Path "D:\jekins\Rena_Demo\AVWPost\publish" -Destination "D:\jekins\Rena_Demo_Product\AVWPost\publish" -Recurse -Force -Verbose
Copy-Item -Path "D:\jekins\Rena_Demo\mrsrc\WindowsTP" -Destination "D:\jekins\Rena_Demo_Product\mrsrc\WindowsTP" -Recurse -Force -Verbose
net use * /del /y
$net = New-Object -com WScript.Network
$drive = "Y:"
$path = "\\10.22.33.10\SWPackage\155\Rena_Demo"
$net.mapnetworkdrive($drive, $path, $true, "wujh","123456")
Copy-Item $ENV:WORKSPACE\Setup\Package\.zip $path
$pdfFolder = Join-Path $path "PdbFolder"
$WindowsNativeName = "WindowsNative__" + $currentTime
$WindowsName = "Windows__" + $currentTime
$currentVersionTime = $currentVersion + "__" + $currentTime
$cppPDB = Join-Path $currentVersionTime $WindowsNativeName
$csharpPDB = Join-Path $currentVersionTime $WindowsName
$destinationFolder = Join-Path $pdfFolder $cppPDB
$destinationCsharpFolder = Join-Path $pdfFolder $csharpPDB
Copy-Item mrsrc\install\pdbfiles $destinationFolder -Recurse -Force
Copy-Item AVWPost\publish\csi\pdb $destinationFolder -Recurse -Force
$srcFolder = "D:\jekins\Rena_Demo\mrsrc\install\Windows\Release\
.pdb"
if (!(Test-Path $destinationCsharpFolder -PathType Container)) {
New-Item -ItemType Directory -Force -Path $destinationCsharpFolder
}
Copy-Item $srcFolder $destinationCsharpFolder -Force'''
archiveArtifacts artifacts: 'Setup\Package\.zip'
}
}
stage('pack Product')
{
agent {
node {
label '157'
customWorkspace "D:/jekins/Rena_Demo_Product"
}
}
steps()
{
bat '''cd .\mrsrc\install\WindowsNative\Release\pyscripts\pyrecon
python compile.py build_ext --inplace'''
bat '''del /f /s /q Setup\Package
rmdir /s /q Setup\Package\appdata
rmdir /s /q Setup\Package\VxWorks
rmdir /s /q Setup\Package\userdata
rmdir /s /q Setup\Package\tools
rmdir /s /q Setup\Package\NeubinSetup
rmdir /s /q Setup\Package\WindowsNative
rmdir /s /q Setup\Package\WindowsFSA
cd Setup
echo "start clean folder"
del /f /s /q Package
rmdir /s /q Package\NeubinSetup
xcopy D:\jekins\Rena_Demo\Setup\ClinicalScripts %cd% /y /e
xcopy ..\mrsrc\tools\Scripts ..\mrsrc\install\tools /y /e
xcopy ..\ThridParty\HubSim ..\mrsrc\install\tools\HubSim\ /y /e /d
copy ..\mrsrc\src\Apps\Tooling\src\SystemErrorCodeScript\output\ErrorCodeConfiguration.exe ..\mrsrc\install\tools\ErrorCodeConfiguration.exe /y
xcopy ..\ThridParty\FileCheck ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\FileCheck\ /y /e /d
xcopy ..\ThridParty\Cleaner ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\Cleaner\ /y /e
IF %ERRORLEVEL% LEQ 1 echo "Clean complete...."
echo "Start to generate wxs file..."
xcopy D:\jekins\Rena_Demo\Setup\ClinicalScripts D:\jekins\Rena_Demo_Product\Setup\ClinicalScripts\ /y /e /d
NeuBinInstall.exe NMS_Product
cd ..\ThridParty\FileCheck
call NMS.MR.FileChcekUpload.exe D:\jekins\Rena_Demo_Product\Setup\Package\NeubinSetup\NMS\NeuBin
cd ..\..\Setup
xcopy ..\ThridParty\FileCheck ..\Setup\Package\NeubinSetup\NMS\NeuBin\tools\FileCheck\ /y /e /d
echo "End to generate wxs file..."
echo "Start to generate WixObj file..."
"X:\WiX Toolset v3.11\bin\candle.exe" -dDev=%cd%\Package\NeubinSetup\ Package.wxs
echo "End to generate WixObj file..."
echo "Start to generate MSI file..."
"X:\WiX Toolset v3.11\bin\light.exe" Package.wixobj -out Package\\NeubinSetup\\Scanner\\NeuBin.msi
echo "End to generate MSI file..."
del WixProj.xml
del Package.wixobj
xcopy ..\mrsrc\install\WindowsExt\Release Package\NeubinSetup\WindowsExt\bin\ /y /e /d
xcopy ..\mrsrc\install\WindowsVICP\Release Package\NeubinSetup\WindowsVICP\bin\ /y /e /d
copy ..\mrsrc\install\version.inc Package\NeubinSetup\WindowsVICP\bin\version.inc /y
xcopy D:\jekins\Rena_Demo\Setup\VICPScripts %cd% /y /e
echo "Start to package..."
del /f /q /a Package\NeubinSetup\WindowsVICP\bin\
.lib
del /f /q /a Package\NeubinSetup\WindowsVICP\bin\.pdb
echo "Start to generate wxs file..."
NeuVICP.exe
echo "End to generate wxs file..."
echo "Start to generate WixObj file..."
"X:\WiX Toolset v3.11\bin\candle.exe" -dDev=%cd%\Package\NeubinSetup\WindowsVICP\bin\ Package.wxs
echo "End to generate WixObj file..."
echo "Start to generate MSI file..."
"X:\WiX Toolset v3.11\bin\light.exe" Package.wixobj -out Package\\NeubinSetup\\VICP\\VICP.msi
echo "End to generate MSI file..."
del WixProj.xml
del Package.wixobj
del /f /s /q Package\NeubinSetup\VICP\VICP.wixpdb
copy ..\mrsrc\install\version.inc Package\NeubinSetup\VICP\version.inc /y
copy ..\mrsrc\install\version.inc Package\NeubinSetup\version.inc /y
xcopy X:\logserver2019 Package\NeubinSetup\MRLogServer /s/y/i/f
xcopy X:\InstallScript\HanScript\
.* Package\NeubinSetup\ /s/y/i/f
del /f /s /q Package\NeubinSetup\Scanner\NeuBin.wixpdb
rd /s /q Package\NeubinSetup\NMS
rd /s /q Package\NeubinSetup\Config
rd /s /q Package\NeubinSetup\WindowsExt
rd /s /q Package\NeubinSetup\WindowsVICP
del /F /S /Q ..\mrsrc\interfaces\include\version.inc'''
powershell '''$currentFolder = $ENV:WORKSPACE
$avwFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\AVW"
$avwsrcFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\AVW_Product\Installation\AVW\"
Copy-Item -Path $avwsrcFolder -Destination $avwFolder -Force -Recurse
Get-ChildItem -Recurse $avwFolder -Include ".svn" | Where-Object { $_ -is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force
$multiScreenFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\MultiScreenAVWConfig\"
$thirdPartyFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\ThirdParty"
Copy-Item -Path $multiScreenFolder -Destination $thirdPartyFolder -Force -Recurse
Get-ChildItem -Recurse $thirdPartyFolder -Include ".svn" | Where-Object { $_ -is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force
$nsaFolder = Join-Path $currentFolder "Setup\\Package\\NeubinSetup\NSA"
$nsasrcFolder = Join-Path $currentFolder "ThridParty\NMSPlatform\NSA_Product\NSA\"
Copy-Item -Path $nsasrcFolder -Destination $nsaFolder -Force -Recurse
$csiConfigSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\config\\CSI"
$csiResourceSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\config\\Resource"
$csibinSrc = Join-Path $currentFolder "AVWPost\\publish\\csi\\bin"
$csiconfigDst = Join-Path $thirdPartyFolder "CSI\\config"
$csiResourceDst = Join-Path $thirdPartyFolder "CSI\\Resource"
$csibinDst = Join-Path $thirdPartyFolder "CSI\\bin"
Copy-Item -Path $csiConfigSrc -Destination $csiconfigDst -Force -Recurse
Copy-Item -Path $csibinSrc -Destination $csibinDst -Force -Recurse
Copy-Item -Path $csiResourceSrc -Destination $csiResourceDst -Force -Recurse
Get-ChildItem -Recurse $nsaFolder -Include ".svn" | Where-Object { $_ -is [System.IO.DirectoryInfo] } | Remove-Item -Recurse -Force'''

                powershell 'python D:\\jekins\\Rena_Demo_Product\\buildPython\\Patchlist_Product.py'
                powershell '''$result =  Get-Content ".\\mrsrc\\install\\version.inc"
                    $currentTime = (Get-Date).ToString(\'yyyyMMdd_HHmmss\')
                    if($result -ne $null){
                      	$7ZipExe = "C:\\Program Files\\7-Zip\\7z.exe"
                    	$currentVersion = $result.Split(\',\')[0]
                        $SetupZipFileName = $currentVersion + "__" + $currentTime + "_Product.zip"
                      	$ScriptFolder = $ENV:WORKSPACE
                      	$zipFolder = Join-Path $ScriptFolder "\\Setup\\Package\\"
                  	    $CUDA = Join-Path $zipFolder "GPUBinSetup"
                        Copy-Item -Path "D:\\Jekins\\GPU\\GPUBinSetup" -Destination $zipFolder -Recurse -Force -Verbose
                      	$SetupSourceFile = Join-Path $ScriptFolder "\\Setup\\Package\\NeubinSetup\\"
                    	$destinationFile = Join-Path $zipFolder $SetupZipFileName
                    	cd $zipFolder
                    	if([System.IO.Directory]::Exists($SetupSourceFile)){
                    		&"$7ZipExe" a $destinationFile $SetupSourceFile $CUDA
                    	}
                        $windowTp = Join-Path $ScriptFolder "\\mrsrc\\WindowsTP\\"
                        $windowTpFileName = $currentVersion + "_windowTp" + "__" + $currentTime + "_Product.zip"
                        $windowTpFile = Join-Path $zipFolder $windowTpFileName
                        if([System.IO.Directory]::Exists($windowTp)){
                        	&"$7ZipExe" a $windowTpFile $windowTp
                        }
                        
                    	$version = $result.Split(\',\')[0].Replace(\'"\',\'\')
                      	net use * /del /y
                    	$net = New-Object -com WScript.Network
                    	$drive = "Z:"
                    	$path = "\\\\10.22.33.10\\SWPackage\\155\\Rena_Demo_Product"
                    	$net.mapnetworkdrive($drive, $path, $true, "wujh","123456")
                    	
                    	Copy-Item D:\\jekins\\Rena_Demo_Product\\Setup\\Package\\*.zip $path
                    	$pdfFolder = Join-Path $path "PdbFolder"
                		$WindowsNativeName = "WindowsNative__" + $currentTime
                    	$WindowsName = "Windows__" + $currentTime
                    	$currentVersionTime =  $version + "__" + $currentTime
                    	
                    	$cppPDB = Join-Path $currentVersionTime $WindowsNativeName
                    	$csharpPDB = Join-Path $currentVersionTime $WindowsName 
                    	$destinationFolder = Join-Path $pdfFolder $cppPDB
                    	$destinationCsharpFolder = Join-Path $pdfFolder $csharpPDB
                    	Copy-Item D:\\jekins\\Rena_Demo_Product\\mrsrc\\install\\pdbfiles $destinationFolder -Recurse -Force 
                    	$srcFolder = "D:\\jekins\\Rena_Demo_Product\\mrsrc\\install\\Windows\\Release\\*.pdb"
                    	if (!(Test-Path $destinationCsharpFolder -PathType Container)) { 
                        	New-Item -ItemType Directory -Force -Path $destinationCsharpFolder 
                    	} 
                    	Copy-Item $srcFolder  $destinationCsharpFolder -Force
                    
                    }
                    else
                    {
                      Write-Host "not found version.inc"
                      exit 1
                    }'''
                  archiveArtifacts artifacts: 'Setup\\Package\\*.zip'

        }
    }
            stage('copy install from Shared disk'){
        agent {
          node {
            label '158'
            customWorkspace "D:/UT"
          }
        }
        steps() 
        {
            powershell '''remove-item D:\\UT\\Rena_Demo_Install -force -recurse
                    net use * /del /y
                    $net = New-Object -com WScript.Network
                    $drive = "Y:"
                    $path = "\\\\10.22.33.10\\SWPackage\\Ut\\Rena_Demo"
                    $net.mapnetworkdrive($drive, $path, $true, "wujh","123456")
                    Move-Item \\\\10.22.33.10\\SWPackage\\Ut\\Rena_Demo\\*.zip D:\\UT\\Rena_Demo'''
            powershell '''$7ZipExe = "C:\\Program Files\\7-Zip\\7z.exe"
                    &"$7ZipExe" x Rena_Demo\\install.zip -oD:\\UT # -o
                    remove-item D:\\UT\\Rena_Demo\\install.zip'''
        }
    }
    stage('Han UT')
    {
        agent {
          node {
            label '158'
            customWorkspace "D:/UT"
          }
        }  
        steps() 
        { 
            script {
                catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') 
            	{
                  
                    bat '''cd Rena_Demo_install\\install 
                        call UnitTest.bat'''
                    bat '''cd Rena_Demo_install\\install\\WindowsNative\\Release
                        rem call scanner_it.exe --gtest_filter=scanner_ctrl_it.*
                        call scanner_it.exe'''
                    bat '''echo "Begin DevConnUT"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call DevConnUT.exe'''
                    bat '''echo "Begin FSM_UT"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call FSM_UT.exe'''
                    bat '''echo "Begin dsexe_ut"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call dsexe_ut.exe'''
                    bat '''cd Rena_Demo_install\\install\\WindowsNative\\Release\\pyscripts\\pyapps\\
                        python DoSeqUt.py '''
            	}
            }
        }
        post {
        always {
                 powershell '''move-item D:\\Logs\\MR\\*.log D:\\UT\\Rena_Demo_install
                 &" C:\\Program Files\\7-Zip\\7z.exe" a Rena_Demo_install\\Han_UT_Log.zip D:\\UT\\Rena_Demo_install\\*.log
                 remove-item D:\\UT\\Rena_Demo_install\\*.log'''
                 archiveArtifacts artifacts: 'Rena_Demo_Install\\Han_UT_Log.zip'
            }
        }

    }
    stage('Tang UT')
    {
       agent {
          node {
            label '158'
            customWorkspace "D:/UT"
          }
        }  
        steps() 
        {
            script {
                catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') 
            	{
                  powershell 'python D:\\UT\\Rena_Demo_install\\install\\ChangeT15.py'
                    bat '''cd Rena_Demo_install\\install 
                        call UnitTest.bat'''
                    bat '''cd Rena_Demo_install\\install\\WindowsNative\\Release
                        rem call scanner_it.exe --gtest_filter=scanner_ctrl_it.*
                        call scanner_it.exe'''
                    bat '''echo "Begin DevConnUT"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call DevConnUT.exe'''
                    bat '''echo "Begin FSM_UT"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call FSM_UT.exe'''
                    bat '''echo "Begin dsexe_ut"
                        cd Rena_Demo_install\\install\\WindowsNative\\Release
                        call dsexe_ut.exe'''
                    bat '''cd Rena_Demo_install\\install\\WindowsNative\\Release\\pyscripts\\pyapps\\
                        python DoSeqUt.py '''
            	}
            }
              
        }
        post { //后执行代码 下面为不管编译什么状态都执行
            always {
                powershell '''move-item D:\\Logs\\MR\\*.log D:\\UT\\Rena_Demo_install
                     &" C:\\Program Files\\7-Zip\\7z.exe" a Rena_Demo_install\\Tang_UT_Log.zip D:\\UT\\Rena_Demo_install\\*.log
                     remove-item D:\\UT\\Rena_Demo_install\\*.log'''
                archiveArtifacts artifacts: 'Rena_Demo_Install\\Tang_UT_Log.zip'
            }
          }
    }
}
        post { 
            failure {
                bat 'curl -X POST -H "Content-Type:text/pln;charset=utf-8" -d "{\\"msg_type\\": \\"interactive\\",\\"card\\": {\\"config\\":{\\"wide_screen_mode\\":true},\\"elements\\": [        {\\"tag\\": \\"div\\",\\"text\\": {\\"tag\\": \\"lark_md\\",\\"content\\": \\"Build Number is: %BUILD_NUMBER%\\"}},{\\"tag\\": \\"div\\",\\"text\\": {\\"tag\\": \\"lark_md\\",\\"content\\": \\"SVN Id is %VAR1%\\"}},{\\"tag\\": \\"div\\",\\"text\\": {\\"content\\": \\"^<at id=all^>^</at^>\\",\\"tag\\": \\"lark_md\\"}}, {\\"actions\\": [{\\"tag\\": \\"button\\",\\"text\\": {\\"content\\": \\"Build Url\\",\\"tag\\": \\"lark_md\\"},\\"url\\": \\"%BUILD_URL%\\",\\"type\\": \\"default\\",\\"value\\": {}}],\\"tag\\": \\"action\\"}],\\"header\\": {\\"title\\": {\\"content\\": \\"%JOB_NAME% Build Failed\\",\\"tag\\": \\"plain_text\\"}, \\"template\\": \\"red\\"}}}" https://open.feishu.cn/open-apis/bot/v2/hook/10d793ef-d11b-4cee-8fce-7f62a495f08e --ssl-no-revoke'
            }
          }

}

标签:Rena,Pipeline,mrsrc,Package,Demo,记录,install,Path,Jenkins
From: https://www.cnblogs.com/zearling100/p/18108251

相关文章

  • Linux服务器运行jenkins
    环境说明linux系统版本:lsb_release-a  JDK版本:1.8  maven版本:3.9.6  不同的操作系统以及软件版本,可能会遇到不一样的问题,一定要注意版本问题。 .1.jenkins版本选择。官网如下,选择一个长期支持板,会稳定很多,也需要考虑JDK版本的支持。因此自己选择使用2.346......
  • The 2023 ICPC Asia Jinan Regional Contest (The 2nd Universal Cup. Stage 17: Jina
    The2023ICPCAsiaJinanRegionalContest(The2ndUniversalCup.Stage17:Jinan)D.LargestDigit题意:给定两个范围la,ra,lb,rb,求在两个范围内选任意两个数相加,求最大的数位思路:暴力枚举即可,遇到9跳出循环voidsolve(){llla,ra,lb,rb;cin>>la>>r......
  • Blazor学习记录_9.C#和JS互操作__
    23.C#和JS互操作23.1C#调用JS,使用IJSRuntimejs代码:<buttononclick="javascript:alter("提示信息")">点我弹出提示</button>C#调用JS:JsInteractive.razor页面代码,InvokeVoidAsync()方法和InvokeAsync()方法@Page"/jsinteractive"<button@onclick=......
  • 记录一次删除文件失败的问题
    一段很简单的删除文件的C#代码,在IIS中有部分文件会出现删除失败的情况,错误提示如下:2024-03-3117:40:21.981+08:00[ERR]Accesstothepath'C:\projects\ows.services.dignite.com\wwwroot\tenants\b384a371-835f-e19b-4d4d-3a1104e4c4a6\files\1734aa3d61314c1b9735d59b......
  • Blazor学习记录_8.预呈现__
    22.NET8中的预呈现预呈现是在服务器上初始呈现页面内容的过程(无需为呈现的控件启用事件处理程序)。服务器会根据初始请求尽快输出页面的HTMLUI,这会让用户感觉应用提高了响应速度。预呈现还可以通过呈现搜索引擎用于计算网页排名的初始HTTP响应的内容,来改进搜索引擎优化(SEO......
  • frida--hook记录
    from__future__importprint_functionfromfrida.coreimportSessionimportfridaimporttimedevice=frida.get_usb_device()#通过USB连接设备#frida.get_device_manager().add_remote_device('192.168.50.96:6666')pid=device.spawn(["com.android.......
  • LeetCode刷题记录——day9
    https://leetcode.cn/problems/game-of-life/?envType=study-plan-v2&envId=2024-spring-sprint-100先创建一个数组,让它比原数组大一圈,然后将其全设为0,在原数组中每有一个1出现,就将其对应位置的新数组的周围全部加一,最后新数组中对应位置的数字就是其周围有多少个活细胞classSo......
  • GIS用户的Deepin V23系统使用记录
    一、系统安装:截止到2024年3月31日,Deepin最新版本为Deepinv23Beta3。在各种软件源下载系统ISO安装,个人是在清华源。1.准备一个U盘或者移动硬盘,安装好Ventoy,把Deepin的ISO放进去,这样,就制作好了系统启动盘。2.推荐为Deepin系统单独准备一块硬盘,从Ventoy启动之后,选择Deepinv23的......
  • QTP/UFT 学习笔记:函数方法等记录
    ​原记录在CSDN上的,后来被自动转VIP了,我搬过来免费看看,小东西没必要VIP,主打一个知识无价,朴实无华。1、Back效果等同于浏览器窗口上的【回退】按钮,使浏览器返回上一个页面​​![](https://img2024.cnblogs.com/blog/1202750/202403/1202750-20240331130946866-2132113900.png)......
  • DIjkstra进阶模板 路径记录 按权重(结点数最小等)记录
    structDIJ{usingi64=longlong;usingPII=pair<i64,i64>;vector<i64>dis,path,node;vector<vector<array<int,3>>>G;intn;DIJ(){}DIJ(intn):n(n){node.resize(n+1,1);......