And*_*era 5 git ssh jenkins gradle-release-plugin
使用 Jenkins 管道,我将存储库 URL 从 http 更改为 ssh git 访问。这样做之后,这项工作不再起作用(在此之前一切正常)。
在日志下方:
:xxxxxx:checkUpdateNeeded
Running [git, remote, update] produced an error: [Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin]
:xxxxxx:checkUpdateNeeded FAILED
:release FAILED
Release process failed, reverting back any changes made by Release Plugin.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkUpdateNeeded'.
> Failed to run [git remote update] - [Fetching origin
][Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin
]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Run Code Online (Sandbox Code Playgroud)
SSH RSA 密钥正常工作,因为: - 我在我们的 Bitbucket 服务器上正确配置,以便读取/写入该存储库 - 我将密钥添加到 ssh-agent - 我可以直接从 jenkins 工作所在的服务器克隆和提交执行。
这是 gradle 构建文件部分:
....
release {
versionPropertyFile="${rootDir}/gradle.properties"
failOnCommitNeeded=false
git{
requireBranch="releases/.*|master"
}
tagTemplate = 'T-'+new Date().format('yy.MM')+'-${version}'
}
task publishRelease(type: GradleBuild) {
tasks = ['publishMavenJavaPublicationToReleaseRepository']
startParameter.projectProperties = [nexusUser: nexusUser, nexusPassword: nexusPassword]
}
....
Run Code Online (Sandbox Code Playgroud)
我可以直接从执行 jenkins 作业的服务器克隆并提交。
那么 Jenkins 也应该这么做,前提是:
如果这两个条件中的任何一个不满足,您需要使用Jenkins SSH Credentials Plugin指定私钥的确切路径。
| 归档时间: |
|
| 查看次数: |
1579 次 |
| 最近记录: |