fix: 规范化部署脚本换行
This commit is contained in:
parent
bde5ba47d9
commit
90be76bb94
@ -186,7 +186,11 @@ function Invoke-BuildServerScript {
|
||||
$scriptId = [guid]::NewGuid().ToString('N')
|
||||
$localTemp = Join-Path ([System.IO.Path]::GetTempPath()) "git-incremental-deploy-$scriptId.sh"
|
||||
$remoteTemp = "/tmp/git-incremental-deploy-$scriptId.sh"
|
||||
[System.IO.File]::WriteAllText($localTemp, $ScriptText, [System.Text.UTF8Encoding]::new($false))
|
||||
# PowerShell here-string 在 Windows 下使用 CRLF;远端 Bash 会把行尾的
|
||||
# `\r` 当作参数内容,导致 `set -euo pipefail` 在脚本第一行就失败。
|
||||
# 上传前统一为 LF,保证脚本在 Linux 构建机上可直接执行。
|
||||
$normalizedScriptText = $ScriptText.Replace("`r`n", "`n").Replace("`r", "`n")
|
||||
[System.IO.File]::WriteAllText($localTemp, $normalizedScriptText, [System.Text.UTF8Encoding]::new($false))
|
||||
|
||||
$authLabel = if ($usePasswordAuth) { 'password auth' } else { 'SSH key auth' }
|
||||
Write-Info "Connecting to build server $BuildServerUser@$BuildServerIP ($authLabel)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user