Esempio n. 1
0
 def testFindRecentBuilds(self):
   """Checks that FindRecentBuilds uses the correct API."""
   ab_client = mock.Mock()
   ab_client.build.return_value.list.return_value.execute.return_value = {
       'builds': [{'buildId': '122556'}, {'buildId': '123456'}]}
   build_ids = androidbuild.FindRecentBuilds(
       ab_client, 'git_mnc-dev', 'mickey-userdebug')
   ab_client.build.assert_called_once_with()
   ab_client.build.return_value.list.assert_called_once_with(
       buildType='submitted',
       branch='git_mnc-dev',
       target='mickey-userdebug')
   # Confirm that it returns them newest to oldest.
   self.assertEqual(build_ids, [123456, 122556])
Esempio n. 2
0
def CmdListBuilds(ab_client, opts):
    """Implements the `abutil list-builds ab://...` subcommand.

  Args:
    ab_client: The androidbuild API client.
    opts: The command line arguments, result of ArgumentParser's parse_args.

  Returns:
    The return status for the command. None or 0 for success.
  """
    branch, target, build_id, filepath = androidbuild.SplitAbUrl(opts.url)
    if build_id or filepath:
        raise ValueError('Invalid URL [%s] must only have branch and target.' %
                         opts.url)
    for build_id in androidbuild.FindRecentBuilds(ab_client, branch, target):
        print(build_id)
Esempio n. 3
0
def FindRecentBuildIds(build_api_proxy, branch, target):
    """Fetch a list of successful completed build ids for a given branch/target.

  This roughly matches the contents of the first page of build results on the
  launch control website, except filtered for only successful/completed builds.

  Since builds sometimes complete out of order, new builds can be added to the
  list out of order.

  Args:
    build_api_proxy: Result of a previous call to OpenBuildApiProxy.
    branch: Name of branch to search. Ex. 'git_mnc-dr-ryu-release'
    target: Build target to search. Ex. 'ryu-userdebug'

  Returns:
    List of build_ids as integers.
  """
    return list(
        reversed(
            androidbuild.FindRecentBuilds(ab_client=build_api_proxy,
                                          branch=branch,
                                          target=target)))