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