ci: support Windows SSH credential binding
这个提交包含在:
父节点
c56eb1abff
当前提交
d44016276f
11
Jenkinsfile
vendored
11
Jenkinsfile
vendored
@ -148,7 +148,11 @@ print('versions.json updated: ${svcName}=${svcVer}')
|
||||
|
||||
stage('Commit Version') {
|
||||
steps {
|
||||
sshagent(credentials: ['jenkins-ssh-key']) {
|
||||
script {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'jenkins-ssh-key', keyFileVariable: 'GIT_SSH_KEY')]) {
|
||||
writeFile file: 'git-ssh.cmd', text: '@echo off\r\nssh -i "%GIT_SSH_KEY%" -o IdentitiesOnly=yes %*\r\n', encoding: 'UTF-8'
|
||||
try {
|
||||
withEnv(["GIT_SSH=${pwd()}\\git-ssh.cmd"]) {
|
||||
bat """
|
||||
chcp 65001 >nul
|
||||
git config user.email "jenkins@xuqm.com"
|
||||
@ -158,6 +162,11 @@ print('versions.json updated: ${svcName}=${svcVer}')
|
||||
git push origin HEAD:main
|
||||
"""
|
||||
}
|
||||
} finally {
|
||||
bat 'if exist git-ssh.cmd del /f /q git-ssh.cmd'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户