Google cloud storage 是否可以自动化Gsutil登录?

Google cloud storage 是否可以自动化Gsutil登录?,google-cloud-storage,Google Cloud Storage,是否可以自动将基于gsutil的文件上传到google云存储,这样登录时就不需要用户干预 我的用例是拥有一个jenkins作业,该作业轮询SCM位置以获取对一组文件的更改。如果检测到任何更改,它会将所有文件上载到特定的Google Cloud Store bucket。在配置凭据后,gsutil无需进一步干预。我怀疑您以用户X的身份运行了gsutil configure,但Jenkins以用户Y的身份运行。因此,~Jenkins/.boto不存在。如果您将.boto文件放在正确的位置,您应该已经

是否可以自动将基于gsutil的文件上传到google云存储,这样登录时就不需要用户干预


我的用例是拥有一个jenkins作业,该作业轮询SCM位置以获取对一组文件的更改。如果检测到任何更改,它会将所有文件上载到特定的Google Cloud Store bucket。

在配置凭据后,gsutil无需进一步干预。我怀疑您以用户X的身份运行了
gsutil configure
,但Jenkins以用户Y的身份运行。因此,
~Jenkins/.boto
不存在。如果您将.boto文件放在正确的位置,您应该已经设置好了

另一种方法是使用多个.boto文件,然后告诉gsutil在
boto\u CONFIG
环境变量中使用哪个文件:

gsutil config  # complete oauth flow
cp ~/.boto /path/to/existing.boto
# detect that we need to upload
BOTO_CONFIG=/path/to/existing.boto gsutil -m cp files gs://bucket
我经常使用此模式将gsutil用于多个帐户:

gsutil config  # complete oauth flow for user A
mv ~/.boto user-a.boto
gsutil config  # complete oauth flow for user B
mv ~/.boto user-b.boto
BOTO_CONFIG=user-a.boto gsutil cp a-file gs://a-bucket
BOTO_CONFIG=user-b.boto gsutil cp b-file gs//b-bucket

你能详细说明你想做什么吗?您是否有运行gsutil的最终用户?@jterrace更新以获取更多详细信息gsutil配置已被弃用使用gcloud auth login nowgsutil配置仍然是配置独立gsutil的正确方法,但gcloud auth login是配置通过Google Cloud SDK分发的gsutil的正确方法