Reputation: 365
I have two private repositories on Github, A and B. Both are Golang projects. Project A depends on repository B. I have linked both repositories to Google Source Code and consented with permissions.
Cloudbuild.yaml
- name: 'gcr.io/cloud-builders/git'
args: ['clone', 'https://source.developers.google.com/p/$PROJECT_ID/r/B']
Log from container builder
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/git
Step #0: Cloning into 'B'...
Finished Step #0
...
Step #1: [0;33m[WARN] [mUnable to checkout github.com/user/B
Step #1: [0;31m[ERROR] [mUpdate failed for github.com/user/B: Unable to get repository: Cloning into '/builder/home/.glide/cache/src/B'...
Step #1: fatal: could not read Username for 'https://github.com': No such device or address
Step #1: : exit status 128
Have anyone got glide to work with container builder and googles own source repositories? I don't want to use 'Cloud Key Management Service' to solve this issue.
Have already tried: https://github.com/GoogleCloudPlatform/cloud-builders/issues/44#issuecomment-325144047
Upvotes: 2
Views: 1508
Reputation: 17813
I have no experience with cloud build but you should use ssh:// instead of https:// for cloning your git repository. Then you'll need to add an SSH key to the repo (in github its called deploy keys, either per repo or for your user account) and use the same key when cloning (in Linux its usually enough to put the private key file under ~/.ssh). I guess that solutions you may found which involve Cloud KMS do the same thing but store the private key securely.
Upvotes: 1