tree: f7744abbe82f386f31f74a2a4c92cc452dd8bce5 [path history] [tgz]
  1. cli/
  2. cmd/
  3. proto/
  4. testdata/
  5. doc.go
  6. inheritance.go
  7. inheritance_test.go
  8. location_tag.go
  9. location_tag_test.go
  10. mapping.go
  11. migrate.go
  12. migrate_test.go
  13. OWNERS
  14. owners.go
  15. owners_test.go
  16. read.go
  17. read_test.go
  18. README.md
  19. validate.go
  20. validate_test.go
go/src/infra/tools/dirmd/README.md

Directory metadata

DIR_METADATA files are a source-focused mechanism by which owners can provide users of their code important information. They map a directory to external entities, including:

  • The Monorail component where bugs should be filed.
  • The team responsible for the code.
  • The OS type.

This infrastructure is overall generic. It has Chromium-specific proto fields, but their usage is not required, and overall this infra can be used by other projects as well.

DIR_METADATA files

DIR_METADATA files are structured text-protobuf files that are amenable to programmatic interaction. Example:

team_email: "team@chromium.org"
os: LINUX
monorail {
  project: "chromium"
  component: "Infra"
}

For file schema, see Metadata message.

Inheritance

DIR_METADATA files apply to all contents of a directory including its subdirectories. By default, individual fields are inherited by subdirectories. In the following, example, the value of monorail.project field in directory a/b is “chromium”.

a/DIR_METADATA

monorail {
  project: "chromium"
  component: "Component"
}

a/b/DIR_METADATA

monorail { component: "Component>Foo" }

dirmd tool

dirmd is a tool to work with DIR_METADATA files. Features:

  • Gather all metadata in a given directory tree and export it to a single JSON file. Optionally remove all redundant metadata, or instead compute inherited metadata.
  • Compute inherited metadata for a given set of directories.
  • Convert from text proto to JSON which is easier to interpret by programs that don't have an easy access to the protobuf files.
  • Validate a given set of files. Used in PRESUBMIT.
  • Fall back to legacy OWNERS files, so that metadata can migrate off of OWNERS files smoothly.

The tool is deployed via depot_tools and is available as a CIPD package.

The tool also hosts implementation of the metadata-exporter builder.

Source code: ./cmd/dirmd.

Library

Go package infra/tools/dirmd can be used work with METADATA files programmatically. The dirmd executable is a thin wrapper around it.

Continuous export

metadata-exporter builder contunuously exports metadata from the src.git to gs://chrome-metadata/metadata_reduced.json and gs://chrome-metadata/metadata_computed.json. metadata_reduced.json is semantic equivalent of metadata_computed.json, but it has all redundant information removed (see MappingForm.REDUCED). As of July 2020, the update latency is up to 20 min.

Links