4591566 发表于 2018-1-7 16:42:09

jenkins中使用tfs插件做增量的版本发布部署

$workbasepath = "D:\jenkins1.65\workspace\CI_KKEnterprise(企业端)\EnterpriseCenterPublish"  
cd $workbasepath
  
#获取最后发布时间
  
if (Test-Path lastPublish.txt) {
  
$lastUpdateTime = Get-Content .\lastPublish.txt
  
#转化为DateTime类型
  
$lastUpdateTime = Get-Date $lastUpdateTime
  
}
  
else{
  
$lastUpdateTime = Get-Date 1/1/1997
  
}
  
#更新本次发布时间文件
  
Get-Date > lastPublish.txt
  
$filePath = "D:\jenkins1.65\workspace\CI_KKEnterprise(企业端)\EnterpriseCenterPublish"
  
$allFile = Get-ChildItem $filePath -recurse | ?{$_.PsIsContainer -eq $false}
  
foreach($file in $allFile)
  
{
  
$daySpan = ($file.LastWriteTime)
  
#if文件的最后修改时间 大于 最后一次更新时间的保留 其它的删除
  
if ($daySpan -ge $lastUpdateTime)
  
{
  
$file.FullName,$daySpan ,"$$$$", $lastUpdateTime
  
}else{
  
$file.FullName,$daySpan, "####" ,$lastUpdateTime
  
Remove-Item $file.FullName -Recurse -Force
  
}
  
}
页: [1]
查看完整版本: jenkins中使用tfs插件做增量的版本发布部署