【问题标题】:Issues cloning a git repo on Bitbucket from Concourse从 Concourse 克隆 Bitbucket 上的 git 存储库的问题
【发布时间】:2019-06-19 18:00:59
【问题描述】:

所以,我在 Bitbucket 上有一个 git repo,我需要在 Concourse 工作中对其进行监控。 repo 可用,我的 ~/.ssh 文件夹中有 SSH 密钥,具有正确的权限(600)。在我的机器上,我可以运行 'git clone git@bitbucket.org:/.git' 命令,并成功克隆 repo。但是,当我尝试将其作为 Concourse 资源进行监控时,它失败了。我究竟做错了什么?我是否缺少配置选项?

以下是我的管道,比较基础。


resources:
- name: dc
  type: git
  source:
    branch: master
    uri: git@bitbucket.org:<company>/<repo>.git


jobs:
- name: Build-docker
  plan:
  - get: dc
    trigger: true
  - task: build-image
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
        repository: ubuntu

     run:
        path: uname
        args: ['r']

我在 GUI 上看到的内容:

stderr:
Cloning into '/tmp/git-resource-repo-cache'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我在本地运行 git-clone 时看到的内容:

git clone git@bitbucket.org:<company>/<repo>.git
Cloning into 'repo'...
Warning: Permanently added the RSA host key for IP address '18.205.93.1' to the list of known hosts.
remote: Counting objects: 50985, done.
remote: Compressing objects: 100% (26500/26500), done.
Receiving objects: 100% (50985/50985), 6.65 MiB | 11.19 MiB/s, done.
remote: Total 50985 (delta 39577), reused 31398 (delta 24283)
Resolving deltas: 100% (39577/39577), done.

【问题讨论】:

  • 你能让 Concourse 使用 SSH 更详细吗?你可以让它指定一个在获取给定 repo 时使用的密钥吗?您是否使用相同的 SSH 密钥对在本地测试克隆?

标签: git bitbucket concourse


【解决方案1】:

您是否将您的私钥输入到某种secrets.yml 文件中?并在您设置管道时加载它? 例如

resources: - name: dc type: git source: branch: master uri: git@bitbucket.org:<company>/<repo>.git private_key: ((private_key))

那就试试吧

fly -t "org" set-pipeline -p "pipeline_name" -c "pipeline.yml file name" --load-vars-from "secrets_file.yml"

这可能行不通,因为我遇到了类似的问题,但您可以尝试该途径

【讨论】:

  • 成功了!我必须在 yaml 文件中指定私钥,并使用 -e 选项将其传递给 fly 命令。非常感谢!
猜你喜欢
  • 1970-01-01
  • 2016-02-05
  • 1970-01-01
  • 2015-03-09
  • 2016-05-01
  • 2018-03-07
  • 2013-01-16
  • 2016-04-27
  • 2013-07-14
相关资源
最近更新 更多