消除AGC流水线密钥插值警告
Project CI / Repository checks (pull_request) Failing after 8s
Project CI / Frontend tests (pull_request) Successful in 3m42s
Project CI / Backend tests (pull_request) Failing after 10s
Project CI / Native shell tests (pull_request) Failing after 14m42s

在Windows PowerShell内设置临时Git SSH命令
This commit is contained in:
2026-09-01 12:09:12 +08:00
parent b913aa9ed3
commit 25b4da1ab7
@@ -29,9 +29,9 @@ pipeline {
stage('Checkout') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: env.GIT_REMOTE_CREDENTIAL_ID, keyFileVariable: 'GIT_SSH_KEY', usernameVariable: 'GIT_SSH_USER')]) {
withEnv(["GIT_SSH_COMMAND=ssh -i \"${env.GIT_SSH_KEY}\" -o StrictHostKeyChecking=no"]) {
powershell '''
powershell '''
$ErrorActionPreference = 'Stop'
$env:GIT_SSH_COMMAND = "ssh -i `"$env:GIT_SSH_KEY`" -o StrictHostKeyChecking=no"
$git = 'C:\\Tools\\Git\\cmd\\git.exe'
if (-not (Test-Path $git)) { throw "找不到 Git: $git" }
if (Test-Path '.git') {
@@ -65,8 +65,7 @@ pipeline {
$resolved = (& $git rev-parse HEAD).Trim()
Set-Content -Path '.jenkins-source-commit' -Value $resolved -NoNewline
Write-Host "源码 commit=$resolved"
'''
}
'''
}
}
}