git_fetch
Checkout a commit from a git repository.
Function Signature
def git_fetch(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str] = [],
within_view: list[str] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_apple_platforms: dict[str, str] = {},
_git_fetch_tool: str = "prelude//git/tools:git_fetch",
allow_cache_upload: bool = True,
contacts: list[str] = [],
default_host_platform: None | str = None,
labels: list[str] = [],
licenses: list[str] = [],
repo: str,
rev: str,
sub_targets: list[str] = [],
) -> None
Parameters
-
name
: (required)name of the target
-
default_target_platform
: (defaults to:None
)specifies the default target platform, used when no platforms are specified on the command line
-
target_compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
exec_compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
-
visibility
: (defaults to:[]
)a list of visibility patterns restricting what targets can depend on this one
-
within_view
: (defaults to:["PUBLIC"]
)a list of visibility patterns restricting what this target can depend on
-
metadata
: (defaults to:{}
)a key-value map of metadata associated with this target
-
tests
: (defaults to:[]
)a list of targets that provide tests for this one
-
modifiers
: (defaults to:[]
)an array of modifiers associated with this target
-
allow_cache_upload
: (defaults to:True
)Whether the results of the fetch can be written to the action cache and CAS.
-
repo
: (required)Url suitable as a git remote.
-
rev
: (required)40-digit hex SHA-1 of the git commit.
-
sub_targets
: (defaults to:[]
)A list of paths within the remote repo to be made accessible as sub-targets. For example if we have a git_fetch with
name = "serde.git"
andsub_targets = ["serde_derive"]
, then other targets would be able to refer to the serde_derive subdirectory of the repo as":serde.git[serde_derive]"
.
Examples
git_fetch(
name = "serde.git",
repo = "https://github.com/serde-rs/serde",
rev = "fccb9499bccbaca0b7eef91a3a82dfcb31e0b149",
)