red*_*888 5 git jenkins jenkins-plugins terraform jenkins-pipeline
我的terraform模块位于通过ssh密钥访问的私有bitbucket存储库中。
我不知道什么git命令terraform运行或如何更改身份验证,但它似乎正在使用不同的ssh配置。
这是我的.tf文件:
module "sdfsdfs" {
source = "git::ssh://bitbucket.org/mycomp/my-module-root//submodule"
}
Run Code Online (Sandbox Code Playgroud)
我在詹金斯管道中运行此程序,并且我正在编辑ssh配置以使用特定的密钥。我已经证明这种方法有效:
sshagent (credentials: ['my-ssh-key']) {
bat 'git clone git@bitbucket.org:mycomp/my-module.git'
}
Run Code Online (Sandbox Code Playgroud)
ssh配置已正确修改,并在jenkins中使用了我的密钥存储。
我不知道实际上是什么地形从git repo中拉出来的,但是它不尊重ssh的配置:
sshagent (credentials: ['my-ssh-key']) {
bat 'terraform init'
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
C:\Program Files\Git\cmd\git.exe exited with 128: Cloning into
'.terraform\modules\c760b746e09bd59ba86aae13dc9e9959'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)
terraform在这里做什么或不做什么?我只想为此会话配置此配置,因此无法为我的jenkins服务器设置全局ssh配置。
这部分是位桶限制,部分是我没有彻底阅读文档。
bitbucket api似乎不支持ssh或其他内容,因为terraform文档仅包含带bitbucket的示例https。
像对待通用git repo一样对待它:
source = "git::ssh://git@bitbucket.org/mycomp/myrepo.git//my-sub-module"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
967 次 |
| 最近记录: |