Module Index
Overview of all Copybara modules with their primary functions.
Core Modules
Section titled “Core Modules”| Module | Key Functions | Description |
|---|---|---|
| core | workflow, move, replace, remove, copy | Workflows and file transformations |
| git | origin, destination, github_origin, github_pr_origin | Git endpoints and operations |
| metadata | squash_notes, scrubber, map_author, expose_label | Commit message transformations |
| authoring | pass_thru, overwrite, allowed | Author handling modes |
File & Archive Modules
Section titled “File & Archive Modules”| Module | Key Functions | Description |
|---|---|---|
| glob | glob(include, exclude) | File pattern matching |
| archive | create, extract | ZIP, TAR, JAR operations |
| patch | apply, quilt_apply | Apply patch files |
Build System Modules
Section titled “Build System Modules”| Module | Key Functions | Description |
|---|---|---|
| buildozer | create, delete, modify, cmd | Bazel BUILD manipulation |
| go | Go-specific operations | Go module handling |
| rust | Rust-specific operations | Cargo/crate handling |
| python | parse_metadata | PyPI metadata parsing |
Data Format Modules
Section titled “Data Format Modules”| Module | Key Functions | Description |
|---|---|---|
| format | buildifier | Code formatting |
| toml | TOML parsing | Config file handling |
| xml | XML operations | XML transformations |
| html | xpath | HTML element selection |
Network & Remote Modules
Section titled “Network & Remote Modules”| Module | Key Functions | Description |
|---|---|---|
| http | HTTP operations | API interactions |
| remotefiles | Remote file fetching | Download dependencies |
Utility Modules
Section titled “Utility Modules”| Module | Key Functions | Description |
|---|---|---|
| re2 | compile, quote | Regex patterns |
| datetime | now, fromtimestamp | Date/time handling |
| hashing | path_sha256_sum, str_sha256_sum | Checksums |
Common Patterns
Section titled “Common Patterns”Basic Workflow
Section titled “Basic Workflow”core.workflow( name = "default", origin = git.origin(url = "...", ref = "main"), destination = git.destination(url = "..."), origin_files = glob(["src/**"]), authoring = authoring.pass_thru("Bot <bot@example.com>"), transformations = [...],)File Operations
Section titled “File Operations”transformations = [ core.move("old/path", "new/path"), core.copy("src/template", "src/generated"), core.remove(glob(["**/*.bak"])), core.replace(before = "old", after = "new"),]Metadata Operations
Section titled “Metadata Operations”transformations = [ metadata.squash_notes(prefix = "Import:\n"), metadata.scrubber("CONFIDENTIAL:.*"), metadata.add_header("Source: internal"),]CLI Quick Reference
Section titled “CLI Quick Reference”# Run workflowcopybara migrate copy.bara.sky [workflow-name]
# Dry runcopybara migrate copy.bara.sky --dry-run
# From specific revisioncopybara migrate copy.bara.sky --last-rev abc123
# Ignore no-opcopybara migrate copy.bara.sky --ignore-noop
# Validate configcopybara validate copy.bara.skyNext Steps
Section titled “Next Steps”- CLI reference - Complete command options
- Glossary - Term definitions