diff --git a/jenkins/Jenkinsfile.ai-game-creator-shell-build b/jenkins/Jenkinsfile.ai-game-creator-shell-build index bfbe19901..e8cdb7096 100644 --- a/jenkins/Jenkinsfile.ai-game-creator-shell-build +++ b/jenkins/Jenkinsfile.ai-game-creator-shell-build @@ -28,8 +28,9 @@ pipeline { stages { stage('Checkout') { steps { - sshagent(credentials: [env.GIT_REMOTE_CREDENTIAL_ID]) { - powershell ''' + 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 ''' $ErrorActionPreference = 'Stop' $git = 'C:\\Tools\\Git\\cmd\\git.exe' if (-not (Test-Path $git)) { throw "找不到 Git: $git" } @@ -64,7 +65,8 @@ pipeline { $resolved = (& $git rev-parse HEAD).Trim() Set-Content -Path '.jenkins-source-commit' -Value $resolved -NoNewline Write-Host "源码 commit=$resolved" - ''' + ''' + } } } }