Using gcloud on Travis CI

2019-06-01 00:40发布

I have gcloud installed and working and a service account gets also activated. I run the following and get a success(?):

$ gcloud auth activate-service-account "${GAE_CLIENT_ACCOUNT}" --key-file "${GAE_CLIENT_KEY_JSON_FILE}"

Activated service account credentials for: [xxxxx@developer.gserviceaccount.com]

Then I run this:

$ gcloud preview app deploy app.yaml --project "${GAE_PROJECT_ID}" --quiet --version "${GAE_PROJECT_VERSION}"

You are about to deploy the following modules:
 - ricochet-robots/default/dev  From: [/home/travis/build/ricochetrobots/ricochetrobots-landing/app.yaml]

Updating module [default]...Go to the following link in your browser:

    https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=xxxxxxxx.apps.googleusercontent.com&access_type=offline

Updating module [default].../

As you can see, it prompts me to follow the link and do an oauth. Because I'm on a ci server, it's not possible to follow the link. How kan I suppress that? Or is there a totally diffrent way of deploying the app automatically.

1条回答
爷的心禁止访问
2楼-- · 2019-06-01 00:59

This is a known issue in version 0.9.61.

For now, you can work around by pinning to a previous version:

gcloud config set component_manager/fixed_sdk_version 0.9.60
gcloud components update

Since you're running in a CI server, you can also set the following environment variable, if you run gcloud components update in your script. This may be an easier fix, depending on your CI server.

CLOUDSDK_COMPONENT_MANAGER_SNAPSHOT_URL=https://dl.google.com/dl/cloudsdk/release/components-v0.9.60.json

Running gcloud preview app deploy --set-default using a service account has the same issue in versions 0.9.57 through 0.9.62. If you'd like to use this command, you can pin to 0.9.56.

We're targeting a fix for version 0.9.63 or shortly thereafter. Follow the issue on the gcloud bug tracker for more updates.

EDIT: This issue was fixed in version 0.9.63.

查看更多
登录 后发表回答