【问题标题】:How to run install pip requirements from private repo in google cloud source?如何从谷歌云源中的私人仓库运行安装 pip 要求?
【发布时间】:2016-12-09 16:24:13
【问题描述】:

我正在尝试构建一个 Dockerfile,它通过 pip 将需求安装到它构建的容器中。我认为谷歌的 SDK/云控制台中可能没有设置正确的东西。我收到此错误:

me@cloud-q2smart:~/github/jokepkg/test$ sudo pip install -r test-ggl-install/requirements.txt 
Obtaining funniest from git+https://source.developers.google.com/p/cloud-q2smart/r/jokepkg#egg=funniest-0.1 (from -r test-ggl-install/requirements.txt (line 1))
Updating ./src/funniest clone
git: 'credential-gcloud.sh' is not a git command. See 'git --help'.
Username for 'https://source.developers.google.com':

该消息看起来像是试图将“credential-gcloud.sh”传递给 git,而 git 正在响应它不知道这对它意味着什么。谷歌为身份验证设置的一些内部手段似乎被破坏了。

我真的很想从私人存储库中正确安装它。我不希望开发团队仅仅因为身份验证机制被破坏而不得不将他们的流程更改为更麻烦的东西。

...但这很棘手...因为 pip 在幕后做了一些事情来调用 git,看起来 google 正在尝试在幕后做一些事情来告诉 git 如何进行身份验证。

我创建了一个项目,试图在谷歌云源的私有仓库中安装一个简单的 python 包。运行说明如下:

( Start up google cloud shell )
$ git clone https://github.com/jnorment-q2/jokepkg.git
# pull down my sample package
$ cd jokepkg
# ( create repo in cloud )
$ git remote add google https://source.developers.google.com/p/cloud-q2smart/r/jokepkg
$ git push google master
# Change to test directory and attempt to build Dockerfile
$ cd test
$ docker build -t test --no-cache .

这应该尝试在我的 Jenkins CI 创建用作临时构建环境的完全相同的容器中构建基于需求的依赖项。第一个将是成功的,因为那个是公共回购,并且没有什么可以配置的安全性。当它到达谷歌版本时它将失败。我不确定如何从 Dockerfile 解决这个问题。

如果有人能引导我朝着正确的方向前进,我将不胜感激。

我可以将凭证文件推送到构建环境/构建从属设备中,但无论 google 做什么似乎都优先于我为 git 设置的凭证:

git config --local credential.username google-svc-account
git config --local credential.helper store --file=/tmp/creds

...我不想将 requirements.txt 文件绑定到特定的用户 ID。

【问题讨论】:

    标签: git docker pip google-cloud-platform google-cloud-source-repos


    【解决方案1】:

    尝试重置 git 配置

    git config --global --unset credential.helper
    
    git config --global --add --path credential.helper gcloud
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-28
      • 2022-12-16
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      • 2020-09-23
      • 2021-01-23
      相关资源
      最近更新 更多