Buildbot master authentication to Cloud Endpoints

TL;DR Each master may have a service account assigned to it. Two modules and together can be used to make authenticated Cloud Endpoints API calls.

Master service accounts

Each master may have a service account assigned:

class MyMaster(Master3):
  # other stuff
  service_account_file = 'service-account-myproject.json'

Service account files should always be named “service-account-[shortname].json”. If service_account_file attribute is set, service_account_path attribute is resolved to [CREDENTIALS_DIR]/[service_account_file]. In order to request a service account for your master, file a bug.

One service account can be used to authorize calls to different GAE apps.

Making authenticated API calls

TL;DR Use to generate an API client for Twisted code at runtime. Use to sign it.

from master import auth
from master import deferred_resource

  '%s/_ah/api/discovery/v1/apis/{api}/{apiVersion}/rest' %

def greet(active_master):
  # active_master is master configuration,
  # what is normally called ActiveMaster in master.cfg

  # Create a signed httplib.Http2 factory.
  http_factory = lambda: auth.create_http(active_master)

  # Create API client for Twisted.
  my_service = yield

  # Call API.
  res = yield my_service.api.greet('John', body={'message': 'hi'})

Using from a recipe

api.gsutil also requires authentication through a service account, however this is managed differently. To use api.gsutil do the following:

  1. Add as an editor on the cloud project associated with the cloud storage bucket you wish to upload to.
  2. File an issue at and add the Infra-Labs label. Mention your the account owning the cloud storage bucket as well as the master/slaves you wish to have authenticated.
  3. Infra Labs will create the necessary service accounts and add them to the slaves in question. They will also be able to roll credentials when necessary.

Creating a service account - guide for admins

See Pupper service accounts