0
我將一個項目添加到teamcity中,需要添加一個powershell腳本來更改一些配置設置並生成壓縮的工件。我已經構建並測試了teamcity之外的腳本文件,但爲了在構建過程中使其工作,我需要獲取工件構建的路徑。將teamcity工件pathTeamcity插入到powershell腳本中
有沒有辦法在c:\artifacts\myproject\build\38
下面的代碼中用一個teamcity參數來替換,這個參數總是會選取最新的build目錄?
#Find and replace various app.config settings
$location = C:\Artifacts\MyProject\Build\38\myApp\myConfig.config";
(Get-Content $location) |
ForEach-Object { $_ -replace '<add key="platform" value="xxxx"/>', '<add key="platform" value="test"/>' } |
Set-Content $location
#Should take source directory and create a zip file from it
$source = "C:\Artifacts\MyProject\Build\38\myApp\"
$destination = "C:\Artifacts\FrontOfficeApi\Build\38\artifact.zip"
GenerateZipFile -DestinationFilePath $destination -SourcePath $source
非常感謝
感謝您的答覆。我決定做的是嘗試將teamcity.build.checkoutDir的值輸出到物理文件。這是由於幾個原因。 1.我自己知道團隊城市是如何工作的2.這是一個更簡單的腳本。 – kcis8rm
但是,當我添加PS構建步驟並運行構建時,出現錯誤,表示沒有兼容的構建代理。當我禁用新的步驟時,構建運行良好!這些設置是:Powershell運行模式:任意,比特性:x86,腳本:源代碼,腳本:$ buildDirectory =「%teamcity.build.chec koutDir%」 $ buildDirectory | Out-File c:\ debug.txt。腳本執行模式:從外部文件執行.ps1。任何建議將是良好的感謝。 – kcis8rm