Package documentation for infra

Table of Contents

Recipe Modules

Recipes

Recipe Modules

recipe_modules / authutil

DEPS: cipd, service_account, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/raw_io, recipe_engine/step

class AuthutilApi(RecipeApi):

AuthutilApi allows generating OAuth2 tokens from locally stored secrets.

This is a thin wrapper over the authutil go executable, which itself calls https://github.com/luci/luci-go/blob/master/client/authcli/authcli.go

def ensure_authutil(self, version=None):

def get_token(self, account, scopes=None, lifetime_sec=None):

recipe_modules / cipd

DEPS: service_account, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step

class CIPDApi(RecipeApi):

CIPDApi provides basic support for CIPD.

This assumes that cipd (or cipd.exe or cipd.bat on windows) has been installed somewhere in $PATH.

def build(self, input_dir, output_package, package_name, install_mode=None):

Builds, but does not upload, a cipd package from a directory.

Args: input_dir (Path) - the directory to build the package from. output_package (Path) - the file to write the package to. package_name (str) - the name of the cipd package as it would appear when uploaded to the cipd package server. install_mode (None|‘copy’|‘symlink’) - the mechanism that the cipd client should use when installing this package. If None, defaults to the platform default (‘copy’ on windows, ‘symlink’ on everything else).

def build_from_pkg(self, pkg_def, output_package):

Builds a package based on a PackageDefinition object.

Args: pkg_def (PackageDefinition) - The description of the package we want to create. output_package (Path) - the file to write the package to.

def build_from_yaml(self, pkg_def, output_package):

Builds a package based on on-disk YAML package definition file.

Args: pkg_def (Path) - The path to the yaml file. output_package (Path) - the file to write the package to.

def create_from_pkg(self, pkg_def, refs=None, tags=None):

Builds and uploads a package based on a PackageDefinition object.

This builds and uploads the package in one step.

Args: pkg_def (PackageDefinition) - The description of the package we want to create. refs (list(str)) - A list of ref names to set for the package instance. tags (dict(str, str)) - A map of tag name -> value to set for the package instance.

Returns the JSON ‘result’ section, e.g.: { “package”: “infra/tools/cipd/android-amd64”, “instance_id”: “433bfdf86c0bb82d1eee2d1a0473d3709c25d2c4” }

def create_from_yaml(self, pkg_def, refs=None, tags=None):

Builds and uploads a package based on on-disk YAML package definition file.

This builds and uploads the package in one step.

Args: pkg_def (Path) - The path to the yaml file. refs (list(str)) - A list of ref names to set for the package instance. tags (dict(str, str)) - A map of tag name -> value to set for the package instance.

Returns the JSON ‘result’ section, e.g.: { “package”: “infra/tools/cipd/android-amd64”, “instance_id”: “433bfdf86c0bb82d1eee2d1a0473d3709c25d2c4” }

@property
def default_bot_service_account_credentials(self):

def describe(self, package_name, version, test_data_refs=None, test_data_tags=None):

def ensure(self, root, packages):

Ensures that packages are installed in a given root dir.

packages must be a mapping from package name to its version, where

  • name must be for right platform (see also platform_suffix),
  • version could be either instance_id, or ref, or unique tag.

If installing a package requires credentials, call set_service_account_credentials before calling this function.

@property
def executable(self):

def initialize(self):

def platform_suffix(self, name=None, arch=None, bits=None):

Use to get full package name that is platform indepdent.

Example:

‘my/package/%s’ % api.cipd.platform_suffix() ‘my/package/linux-amd64’

Optional platform bits and architecture may be supplied to generate CIPD suffixes for other platforms. If any are omitted, the current platform parameters will be used.

def register(self, package_name, package_path, refs=None, tags=None):

def search(self, package_name, tag):

def set_ref(self, package_name, version, refs):

def set_service_account_credentials(self, path):

def set_tag(self, package_name, version, tags):

recipe_modules / fuchsia

DEPS: cipd, goma, gsutil, hash, isolated, jiri, minfs, qemu, swarming, tar, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/source_manifest, recipe_engine/step

class FuchsiaApi(RecipeApi):

APIs for checking out, building, and testing Fuchsia.

def analyze_collect_result(self, step_name, result, zircon_build_dir):

Analyzes a swarming.CollectResult and reports results as a step.

Args: step_name (str): The display name of the step for this analysis. result (swarming.CollectResult): The swarming collection result to analyze. zircon_build_dir (Path): A path to the zircon build directory for symbolization artifacts.

Raises: A StepFailure if a kernel panic is detected, or if the tests timed out. An InfraFailure if the swarming task failed for a different reason.

def analyze_test_results(self, step_name, minfs_image_path, build_dir, output):

Analyzes a MinFS image filled with task results, whose path is derived from a CollectResult.

Args: step_name (str): The name of the step under which to test the analysis steps. minfs_image_path (Path): A relative path to the MinFS image that may be used to derive the full path to the MinFS image from a CollectResult. build_dir (Path): A path to the build directory for symbolization artifacts. output (str): Kernel output which may be passed to the symbolizer script.

Raises: A StepFailure if any of the discovered tests failed.

def build(self, target, build_type, packages, variants=(), gn_args=(), test_cmds=()):

Builds Fuchsia from a Jiri checkout.

Expects a Fuchsia Jiri checkout at api.path[‘start_dir’].

Args: target (str): The build target, see TARGETS for allowed targets build_type (str): One of the build types in BUILD_TYPES packages (sequence[str]): A sequence of packages to pass to GN to build variants (sequence[str]): A sequence of build variants to pass to gen.py via --variant gn_args (sequence[str]): Additional arguments to pass to GN test_cmds (sequence[str]): A sequence of commands to run on the device during testing. If empty, no test package will be added to the build.

Returns: A FuchsiaBuildResults, representing the recently completed build.

def checkout(self, manifest, remote, project=None, patch_ref=None, patch_gerrit_url=None, patch_project=None, upload_snapshot=False):

Uses Jiri to check out a Fuchsia project.

The patch_* arguments must all be set, or none at all. The checkout is made into api.path[‘start_dir’].

Args: manifest (str): A path to the manifest in the remote (e.g. manifest/minimal) remote (str): A URL to the remote repository which Jiri will be pointed at project (str): The name of the project patch_ref (str): A reference ID to the patch in Gerrit to apply patch_gerrit_url (str): A URL of the patch in Gerrit to apply patch_project (str): The name of Gerrit project upload_snapshot (bool): Whether to upload a Jiri snapshot to GCS

def test(self, build):

Tests a Fuchsia build.

Expects the build and artifacts to be at the same place they were at the end of the build.

Args: build (FuchsiaBuildResults): The Fuchsia build to test

recipe_modules / gerrit

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/step

class GerritApi(RecipeApi):

Module for querying a Gerrit host through the Gerrit API.

def abandon(self, name, change_id, message=None):

Abandons a change.

Returns the details of the change, after attempting to abandon.

Args: name (str): The name of the step. change_id (str): A change ID that uniquely defines a change on the host. message (str): A message explaining the reason for abandoning the change.

def change_details(self, name, change_id):

Returns a JSON dict of details regarding a specific change.

Args: name (str): The name of the step. change_id (str): A change ID that uniquely defines a change on the host.

def create_change(self, name, project, subject, branch, topic=None):

Creates a new change for a given project on the gerrit host.

Returns the details of the newly-created change.

Args: name (str): The name of the step. project (str): The name of the project on the host to create a change for. subject (str): The subject of the new change. branch (str): The branch onto which the change will be made. topic (str): A gerrit topic that can be used to atomically land the change with other changes in the same topic.

def ensure_gerrit(self, version=None):

@host.setter
def host(self, host):

def set_review(self, name, change_id, labels=None, reviewers=None, ccs=None, revision=‘current’):

Sets a change at a revision for review. Can optionally set labels, reviewers, and CCs.

Returns updated labels, reviewers, and whether the change is ready for review as a JSON dict.

Args: name (str): The name of the step. change_id (str): A change ID that uniquely defines a change on the host. labels (dict): A map of labels (with names as strings, e.g. ‘Code-Review’) to the integral values you wish to set them to. reviewers (list): A list of strings containing reviewer IDs (e.g. email addresses). ccs (list): A list of strings containing reviewer IDs (e.g. email addresses). revision (str): A revision ID that identifies a revision for the change (default is ‘current’).

recipe_modules / git

DEPS: recipe_engine/context, recipe_engine/file, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step

class GitApi(RecipeApi):

GitApi provides support for Git.

def __call__(self, *args, **kwargs):

Return a git command step.

def checkout(self, url, path=None, ref=None, recursive=False, submodules=True, submodule_force=False, remote=‘origin’, file=None, **kwargs):

Checkout a given ref and return the checked out revision.

Args: url (str): url of remote repo to use as upstream path (Path): directory to clone into ref (str): ref to fetch and check out recursive (bool): whether to recursively fetch submodules or not submodules (bool): whether to sync and update submodules or not submodule_force (bool): whether to update submodules with --force remote (str): name of the remote to use file (str): optional path to a single file to checkout

def commit(self, message, *files, **kwargs):

def get_hash(self, commit=‘HEAD’, **kwargs):

Find and return the hash of the given commit.

def get_timestamp(self, commit=‘HEAD’, test_data=None, **kwargs):

Find and return the timestamp of the given commit.

def push(self, ref, remote=‘origin’, **kwargs):

def rebase(self, branch=‘master’, remote=‘origin’, **kwargs):

Run rebase HEAD onto branch

recipe_modules / gitiles

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step, recipe_engine/url

class GitilesApi(RecipeApi):

Module for polling a Git repository using the Gitiles web interface.

def ensure_gitiles(self, version=None):

def fetch(self, url, file_path, branch=‘master’, step_name=None, timeout=None, test_data=None):

Downloads raw file content from a Gitiles repository.

Args: url (str): base URL to the repository. file_path (str): relative path to the file from the repository root. branch (str): branch of the repository. step_name (str): custom name for this step (optional). timeout (int): number of seconds to wait before failing.

Returns: Raw file content.

def log(self, url, treeish, limit=0, step_name=None, test_data={}):

Returns the most recent commits for treeish object.

Args: url (str): base URL of the remote repository. treeish (str): tree object identifier. limit (int): number of commits to limit the fetching to. step_name (str): custom name for this step (optional).

def refs(self, url, refspath=‘refs/heads’, step_name=‘refs’, test_data=[]):

Resolves each ref in a repository to git revision

Args: url (str): URL of the remote repository. refspath (str): limits which refs to resolve.

recipe_modules / go

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step

class GoApi(RecipeApi):

GoApi provides support for Go.

def __call__(self, *args, **kwargs):

Return a Go command step.

def ensure_go(self, use_deprecated=False, version=None):

Ensures that go distribution is installed.

@property
def go_executable(self):

@property
def go_root(self):

def inline(self, program, add_go_log=True, **kwargs):

Run an inline Go program as a step. Program is output to a temp file and run when this step executes.

recipe_modules / goma

DEPS: cipd, service_account, recipe_engine/context, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step

class GomaApi(RecipeApi):

GomaApi contains helper functions for using goma.

@contextmanager
def build_with_goma(self, env={}):

Make context wrapping goma start/stop.

Raises: StepFailure or InfraFailure if it fails to build.

def ensure_goma(self, canary=False):

@property
def goma_ctl(self):

@property
def goma_dir(self):

@contextmanager
def goma_env(self, env):

@property
def json_path(self):

@property
def recommended_goma_jobs(self):

Return the recommended number of jobs for parallel build using Goma.

This function caches the _goma_jobs.

@property
def service_account_json_path(self):

def set_goma_dir(self, goma_dir):

This function is for local recipe test only.

def start(self, env={}, **kwargs):

Start goma compiler_proxy.

A user MUST execute ensure_goma beforehand. It is user's responsibility to handle failure of starting compiler_proxy.

def stop(self, env={}, **kwargs):

Stop goma compiler_proxy.

A user MUST execute start beforehand. It is user's responsibility to handle failure of stopping compiler_proxy.

Raises: StepFailure if it fails to stop goma.

recipe_modules / gsutil

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/python, recipe_engine/step

class GSUtilApi(RecipeApi):

GSUtilApi provides support for GSUtil.

def __call__(self, *args, **kwargs):

Return a step to run arbitrary gsutil command.

def copy(self, src_bucket, src, dst_bucket, dst, link_name=‘gsutil.copy’, unauthenticated_url=False, **kwargs):

def ensure_gsutil(self, version=None):

@non_step
def join(self, *parts):

Constructs a GS path from composite parts.

@non_step
def normalize(self, url):

Normalize a GS URL using the gs:// URL prefix.

def upload(self, bucket, src, dst, link_name=‘gsutil.upload’, unauthenticated_url=False, **kwargs):

recipe_modules / hash

DEPS: recipe_engine/path, recipe_engine/python, recipe_engine/raw_io

class HashApi(RecipeApi):

HashApi provides file hashing functionality.

def md5(self, name, source, test_data=''):

def sha1(self, name, source, test_data=''):

def sha224(self, name, source, test_data=''):

def sha256(self, name, source, test_data=''):

def sha384(self, name, source, test_data=''):

def sha512(self, name, source, test_data=''):

recipe_modules / isolated

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/raw_io, recipe_engine/step

class IsolatedApi(RecipeApi):

APIs for interacting with isolates.

def __call__(self, *args, **kwargs):

Return an isolate command step.

def ensure_isolated(self, version=None):

Ensures that isolate client is installed.

@isolate_server.setter
def isolate_server(self, value):

Changes URL of Isolate server to use.

def isolated(self):

Returns an Isolated object that can be used to archive a set of files and directories.

@property
def isolated_client(self):

recipe_modules / jiri

DEPS: cipd, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/raw_io, recipe_engine/source_manifest, recipe_engine/step

class JiriApi(RecipeApi):

JiriApi provides support for Jiri managed checkouts.

def __call__(self, *args, **kwargs):

Return a jiri command step.

def checkout(self, manifest, remote, project=None, patch_ref=None, patch_gerrit_url=None, patch_project=None):

def clean(self, all=False, **kwargs):

def edit_manifest(self, manifest, projects=None, imports=None, test_data=None):

def ensure_jiri(self, version=None):

def import_manifest(self, manifest, remote, name=None, overwrite=False, **kwargs):

def init(self, dir=None, **kwargs):

@property
def jiri(self):

def patch(self, ref, host=None, project=None, delete=False, force=False, rebase=False):

def project(self, projects, test_data=None):

def run_hooks(self, local_manifest=False):

def snapshot(self, file=None, test_data=None, **kwargs):

def source_manifest(self, file=None, test_data=None, **kwargs):

def update(self, gc=False, rebase_tracked=False, local_manifest=False, run_hooks=True, snapshot=None, **kwargs):

recipe_modules / minfs

DEPS: recipe_engine/file, recipe_engine/path, recipe_engine/step

class MinfsApi(RecipeApi):

MinfsApi provides support for Fuchia's MinFS tool.

Currently this module can only be used with a Zircon build, which produces the local minfs binary.

def cp(self, from_path, to_path, image, **kwargs):

Copies a file or directory from an image.

from_path: string/path/placeholder The path to copy from. to_path: string/path/placeholder The path to copy to. image: string/path The path to the MinFS image.

To specify a location inside of the MinFS image, prefix the path with ‘::’.

def create(self, path, size=‘100M’, **kwargs):

Creates a MinFS image at the given path.

path: string The path at which to create the image. size: string The size of the image, number followed by unit. Defaults to 100M.

@minfs_path.setter
def minfs_path(self, path):

Sets the path to the minfs command.

recipe_modules / qemu

DEPS: cipd, recipe_engine/context, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step

class QemuApi(RecipeApi):

QemuApi provides support for QEMU.

@contextmanager
def background_run(self, *args, **kwargs):

def create_image(self, image, backing_file, fmt=‘qcow2’):

Creates a QEMU image from a backing file.

Args: image (Path): Path to the image to be created. backing_file (Path): The backing file to use for the image. fmt (str): The format of the image.

def ensure_qemu(self, version=None):

def qemu_executable(self, arch):

@property
def qemu_img(self):

def run(self, step_name, *args, **kwargs):

recipe_modules / service_account

DEPS: recipe_engine/path

class ServiceAccountApi(RecipeApi):

ServiceAccountApi provides access to service account keys.

def get_json_path(self, account):

recipe_modules / swarming

DEPS: cipd, isolated, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/raw_io, recipe_engine/step

class SwarmingApi(RecipeApi):

APIs for interacting with swarming.

def __call__(self, *args, **kwargs):

Return a swarming command step.

def collect(self, timeout, requests_json=None, tasks=[]):

Waits on a set of Swarming tasks.

Returns both the step result as well as a set of neatly parsed results.

Args: timeout: timeout to wait for result. requests_json: load details about the task(s) from the json file. tasks: list of task ids to wait on.

def ensure_swarming(self, version=None):

Ensures that swarming client is installed.

@property
def swarming_client(self):

@swarming_server.setter
def swarming_server(self, value):

Changes URL of Swarming server to use.

def trigger(self, name, raw_cmd, isolated=None, dump_json=None, dimensions=None, expiration=None, io_timeout=None, idempotent=False, cipd_packages=None, outputs=None):

Triggers a Swarming task.

Args: name: name of the task. raw_cmd: task command. isolated: hash of isolated test on isolate server. dump_json: dump details about the triggered task(s). dimensions: dimensions to filter slaves on. expiration: seconds before this task request expires. io_timeout: seconds to allow the task to be silent. idempotent: whether this task is considered idempotent. cipd_packages: list of 3-tuples corresponding to CIPD packages needed for the task: (‘path’, ‘package_name’, ‘version’), defined as follows: path: Path relative to the Swarming root dir in which to install the package. package_name: Name of the package to install, eg. “infra/tools/authutil/${platform}” version: Version of the package, either a package instance ID, ref, or tag key/value pair. outputs: list of paths to files which can be downloaded via collect.

recipe_modules / tar

DEPS: cipd, recipe_engine/context, recipe_engine/path, recipe_engine/platform, recipe_engine/python, recipe_engine/step

class TarApi(RecipeApi):

Provides steps to tar and untar files.

def create(self, archive, compression=None):

Returns TarPackage object that can be used to compress a set of files.

def ensure_tar(self, version=None):

Ensures that bsdtar is installed.

def extract(self, step_name, archive, dir=None, verbose=False):

Step to uncompress |tar_file| file.

Recipes

recipes / authutil:examples/full

DEPS: authutil, recipe_engine/json, recipe_engine/platform, recipe_engine/properties

def RunSteps(api, scopes, lifetime_sec):

recipes / cipd:examples/full

DEPS: cipd, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/step

def RunSteps(api, use_pkg, pkg_files, pkg_dirs, ver_files, install_mode):

recipes / cipd:examples/platform_suffix

DEPS: cipd, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/step

def RunSteps(api, arch_override, bits_override, expect_error):

recipes / clang_toolchain

DEPS: cipd, git, gitiles, gsutil, hash, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/tempfile

Recipe for building Clang toolchain.

def RunSteps(api, url, ref, revision):

recipes / cobalt

DEPS: cipd, jiri, recipe_engine/context, recipe_engine/path, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

Recipe for building and testing Cobalt.

def RunSteps(api, patch_gerrit_url, patch_project, patch_ref, project, manifest, remote):

recipes / dart

DEPS: fuchsia, swarming, recipe_engine/properties

Builds the Fuchsia Dart test image and runs the Dart tests.

def RunSteps(api, manifest, remote, target, build_type):

recipes / fuchsia

DEPS: fuchsia, swarming, recipe_engine/properties

Recipe for building Fuchsia and running tests.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, target, build_type, packages, variant, gn_args, run_tests, runtests_args, upload_snapshot):

recipes / fuchsia:examples/fuchsia

DEPS: fuchsia, goma, swarming, recipe_engine/json, recipe_engine/properties, recipe_engine/raw_io

Recipe for building Fuchsia and running tests.

def RunSteps(api, patch_gerrit_url, patch_project, patch_ref, project, manifest, remote, target, build_type, packages, variants, gn_args, run_tests, runtests_args, upload_snapshot):

recipes / fuchsia_roller

DEPS: gerrit, git, gitiles, jiri, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/properties, recipe_engine/step, recipe_engine/url

Recipe for rolling Fuchsia layers into upper layers.

def RunSteps(api, category, project, manifest, remote, import_in, import_from, revision, dry_run, poll_timeout_secs, poll_interval_secs):

recipes / gerrit:examples/full

DEPS: gerrit, recipe_engine/json, recipe_engine/properties

def RunSteps(api):

recipes / git:examples/full

DEPS: git, recipe_engine/context, recipe_engine/file, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/time

def RunSteps(api):

recipes / gitiles:examples/full

DEPS: gitiles, recipe_engine/properties

def RunSteps(api):

recipes / go:examples/full

DEPS: go, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

def RunSteps(api):

recipes / go_toolchain

DEPS: cipd, go, gsutil, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/step, recipe_engine/tempfile

Recipe for building Go toolchain.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, manifest, remote):

recipes / goma:examples/full

DEPS: goma, recipe_engine/platform, recipe_engine/properties, recipe_engine/step

def RunSteps(api):

recipes / gsutil:examples/full

DEPS: gsutil, recipe_engine/path

def RunSteps(api):

recipes / hash:examples/full

DEPS: hash, recipe_engine/path

def RunSteps(api):

recipes / infra

DEPS: cipd, git, go, jiri, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/url

Recipe for building and publishing infra tools.

This recipe builds one or more Go binaries in the specified project and publishes them all to CIPD. If one or more tests for any package in the project fail, or one or more packages fail to build, execution stops and no packages are uploaded.

This recipe uses golang/dep to manage dependencies, so the given project is expected to have a Gopkg.toml file specifying its dependency restrictions.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, revision):

def UploadPackage(api, bin_name, bin_dir, revision, remote):

Creates and uploads a CIPD package containing the tool at bin_dir/bin_name.

The tool is published to CIPD under the path ‘fuchsia/infra/$bin_name/$platform’

Args: bin_dir: The absolute path to the parent directory of bin_name. bin_name: The name of the tool binary

recipes / isolated:examples/full

DEPS: isolated, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/step

def RunSteps(api):

recipes / jiri

DEPS: cipd, git, go, gsutil, jiri, recipe_engine/context, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/time

Recipe for building Jiri.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, target):

def UploadPackage(api, revision, staging_dir):

recipes / jiri:examples/full

DEPS: jiri, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

def RunSteps(api):

recipes / minfs:examples/full

DEPS: minfs, recipe_engine/path, recipe_engine/step

def RunSteps(api):

recipes / modules

DEPS: goma, jiri, recipe_engine/context, recipe_engine/path, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

Recipe for building and running pre-submit checks for the modules repo.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, project_path):

recipes / qemu

DEPS: cipd, gsutil, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/tempfile

Recipe for building QEMU.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, manifest, remote, platform):

recipes / qemu:examples/full

DEPS: qemu, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

def RunSteps(api, arch, kvm):

recipes / recipes

DEPS: jiri, recipe_engine/context, recipe_engine/path, recipe_engine/properties, recipe_engine/python, recipe_engine/step

Recipe for testing Recipes.

def RunSteps(api, patch_gerrit_url, patch_project, patch_ref, project, manifest, remote):

recipes / rust_toolchain

DEPS: cipd, git, gitiles, gsutil, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step, recipe_engine/url

Recipe for building Rust toolchain.

def RunSteps(api, url, ref, revision):

recipes / sdk

DEPS: cipd, go, goma, gsutil, hash, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step, recipe_engine/tempfile

Recipe for building Fuchsia SDKs.

def BuildFuchsia(api, release_build, gn_target, zircon_project, fuchsia_build_dir, packages, use_goma, gn_args):

def BuildZircon(api, project):

@contextmanager
def GomaContext(api, use_goma):

def MakeSdk(api, outdir, sdk):

def PackageArchive(api, sdk):

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, use_goma, gn_args):

def UploadArchive(api, sdk, digest):

def UploadPackage(api, outdir, digest):

recipes / service_account:examples/full

DEPS: service_account

def RunSteps(api):

recipes / swarming:examples/full

DEPS: swarming, recipe_engine/json, recipe_engine/path

def RunSteps(api):

recipes / swift_toolchain

DEPS: cipd, git, gitiles, goma, gsutil, jiri, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/python, recipe_engine/raw_io, recipe_engine/step, recipe_engine/url

Recipe for building Swift toolchain.

def BuildFuchsia(api, target_cpu, zircon_project, fuchsia_out_dir):

def RunSteps(api, url, ref, revision, goma_dir):

recipes / tar:examples/full

DEPS: tar, recipe_engine/context, recipe_engine/file, recipe_engine/path, recipe_engine/platform, recipe_engine/step

def RunSteps(api):

recipes / third_party_rust_crates

DEPS: jiri, recipe_engine/context, recipe_engine/path, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/step

Recipe for checking licenses in the repo hosting third-party Rust crates.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url):

recipes / web_view

DEPS: goma, gsutil, jiri, recipe_engine/context, recipe_engine/path, recipe_engine/properties, recipe_engine/step

Recipe for building WebView.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, target):

recipes / zircon

DEPS: cipd, fuchsia, goma, isolated, jiri, minfs, qemu, swarming, recipe_engine/context, recipe_engine/file, recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/properties, recipe_engine/raw_io, recipe_engine/source_manifest, recipe_engine/step, recipe_engine/tempfile

Recipe for building Zircon.

def Build(api, target, toolchain, src_dir, use_isolate):

Builds zircon and returns a path to the build output directory.

def FinalizeTestsTasks(api, core_task, booted_task, booted_task_output_image, build_dir, timeout=‘20m’):

Waits on the tasks running core tests and booted tests, then analyzes the results.

Args: core_task (str): The swarming task ID of the task running core tests. booted_task (str): The swarming task ID of the task running booted tests. build_dir (Path): A path to the directory containing build artifacts. timeout (str): A timeout formatted as a Golang Duration-parsable string.

def GenerateQEMUCommand(arch, cmdline, use_kvm, blkdev=''):

GenerateQEMUCommand generates a QEMU command for executing Zircon tests.

Args: arch (str): The target architecture to execute tests for. cmdline (list[str]): A list of kernel command line arguments to pass to zircon. use_kvm (bool): Whether or not KVM should be enabled in the QEMU command. blkdev (str): Optional relative path to an image name on the test machine. If blkdev is non-empty, the triggered task will have QEMU declare an additional block device with the backing image being a file located at the relative path provided. The image must be on the test machine prior to command execution, so it should get there either via CIPD or isolated.

Returns: A list[str] representing QEMU command which invokes QEMU from the default CIPD installation directory.

def RunSteps(api, category, patch_gerrit_url, patch_project, patch_ref, patch_storage, patch_repository_url, project, manifest, remote, target, toolchain, goma_dir, use_isolate, use_kvm, run_tests):

def RunTests(api, name, build_dir, *args, **kwargs):

def TriggerTestsTask(api, name, cmd, arch, use_kvm, isolated_hash, output=''):

TriggerTestsTask triggers a task to execute a command on a remote machine.

The remote machine is guaranteed to have QEMU installed

Args: api: Recipe engine API object. name (str): Name of the task. cmd (seq[str]): The command to execute with each argument as a separate list entry. arch (str): The target architecture to execute tests for. use_kvm (bool): Whether or not a bot with KVM should be requested for the task. isolated_hash (str): A digest of the isolated containing the build artifacts. output (str): Optional relative path to an output file on the target machine which will be isolated and returned back to the machine executing this recipe.

Returns: The task ID of the triggered task.

@contextlib.contextmanager
def no_goma():