如何在谷歌云源中从私人仓库运行安装点需求?

时间:2016-08-03 19:34:08

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

我正在尝试构建一个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如何进行身份验证。

我创建了一个项目,试图在google云源中的私有仓库中安装一个简单的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解决这个问题。

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

我可以将凭证文件推送到构建环境/构建奴隶,但谷歌正在做的事情似乎优先于我为git设置的信誉:

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

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

1 个答案:

答案 0 :(得分:0)

尝试重置git配置

git config --global --unset credential.helper

git config --global --add --path credential.helper gcloud
相关问题