List of arbitrary text tags. Tags may be any valid string; default is
the empty list.
Tags can be used on any rule. Tags on test and
test_suite
rules are useful for categorizing the tests.
Tags on non-test rules are used to control sandboxed execution of
genrule
s and
Skylark
actions, and for parsing by humans and/or external tools.
Bazel modifies the behavior of its sandboxing code if it finds the following
keywords in the tags
attribute of any test rule or
genrule
, or the keys of execution_requirements
for
any Skylark action.
local
keyword results in the action or test never being
run remotely or inside the
sandbox.
For genrules and tests, marking the rule with the local = 1
attribute has the same effect.
requires-network
keyword allows access to the external
network from inside the sandbox.
Tags on tests are generally used to annotate a test's role in your debug and release process. Typically, tags are most useful for C++ and Python tests, which lack any runtime annotation ability. The use of tags and size elements gives flexibility in assembling suites of tests based around codebase check-in policy.
Bazel modifies test running behavior if it finds the following keywords in the
tags
attribute of the test rule:
exclusive
keyword will force the test to be run in the
"exclusive" mode, ensuring that no other tests are running at the
same time. Such tests will be executed in serial fashion after all build
activity and non-exclusive tests have been completed. They will also always
run locally and thus without sandboxing.
manual
keyword will force the test target to not be included in target pattern
wildcards (...
, :*
, :all
, etc); the test target will be
neither built nor run. It will also be ignored by the test_suite
rules that do not
mention this test explicitly. The only way to build or run such a test is to specify it via an
explicit target pattern on the command line.
external
keyword will force test to be unconditionally
executed (regardless of --cache_test_results
value).