Skip to content

Commit

Permalink
Pants: Add pack_metadata targets to BUILD files (#5871)
Browse files Browse the repository at this point in the history
* pants: add pack_metadata targets

* add packs_metadata and related targets

* Add pack_metadata dependencies

* Add pack_metadata for more fixtures

* Allow pants to detect packs fixture usage

* Cleanup fixtures BUILD files

Several fixtures have been adjusted so pants can infer them.
So, I dropped the hard-coded dep in the BUILD files.

* add BUILD metadata for st2tests/testpacks

* depend on pack_metadata in st2tests.fixtures.packs.core.fixture

* Add pack_metadata targets in st2reactor pack fixtures

* Enable pants-plugins/pack_metadata

This reverts commit 4a1b241.

* update changelog entry

* disable spurious pack_metadata target where there is no metadata

* add pack_metadata to contrib/debug with `./pants tailor ::`
  • Loading branch information
cognifloyd authored Jan 27, 2023
1 parent 33a5039 commit 6e773e6
Show file tree
Hide file tree
Showing 68 changed files with 389 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Added
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
to pants' use of PEX lockfiles. This is not a user-facing addition.
#5778 #5789 #5817 #5795 #5830 #5833 #5834 #5841 #5840 #5838 #5842 #5837 #5849 #5850
#5846 #5853 #5848 #5847 #5858 #5857 #5860 #5868
#5846 #5853 #5848 #5847 #5858 #5857 #5860 #5868 #5871
Contributed by @cognifloyd

* Added a joint index to solve the problem of slow mongo queries for scheduled executions. #5805
Expand Down
3 changes: 3 additions & 0 deletions contrib/chatops/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
8 changes: 7 additions & 1 deletion contrib/core/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
python_sources()
pack_metadata(
name="metadata",
)

python_requirements(
name="reqs",
Expand All @@ -7,3 +9,7 @@ python_requirements(
# https://github.com/pantsbuild/pants/pull/17390
module_mapping={"mail-parser": ["mailparser"]},
)

python_sources(
dependencies=[":metadata"],
)
3 changes: 3 additions & 0 deletions contrib/debug/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
3 changes: 3 additions & 0 deletions contrib/default/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
4 changes: 4 additions & 0 deletions contrib/examples/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
pack_metadata(
name="metadata",
)

# Using `python_requirements()` here results in:
# ">1 target exports this module, so it is ambiguous which to use"
# This error refers to the "requests" module.
Expand Down
3 changes: 3 additions & 0 deletions contrib/hello_st2/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
4 changes: 4 additions & 0 deletions contrib/linux/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
pack_metadata(
name="metadata",
)

python_requirements(
name="reqs",
)
3 changes: 3 additions & 0 deletions contrib/packs/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
9 changes: 8 additions & 1 deletion contrib/packs/tests/fixtures/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
python_sources()
python_sources(
dependencies=[
"./stackstorm-test:metadata",
"./stackstorm-test2:metadata",
"./stackstorm-test3:metadata",
"./stackstorm-test4:metadata",
],
)
3 changes: 3 additions & 0 deletions contrib/packs/tests/fixtures/stackstorm-test/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
3 changes: 3 additions & 0 deletions contrib/packs/tests/fixtures/stackstorm-test2/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
3 changes: 3 additions & 0 deletions contrib/packs/tests/fixtures/stackstorm-test3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
3 changes: 3 additions & 0 deletions contrib/packs/tests/fixtures/stackstorm-test4/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pack_metadata(
name="metadata",
)
2 changes: 1 addition & 1 deletion pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ backend_packages = [
# internal plugins in pants-plugins/
"pants.backend.plugin_development",
"api_spec",
#"pack_metadata",
"pack_metadata",
"sample_conf",
"schemas",
]
Expand Down
8 changes: 7 additions & 1 deletion st2reactor/tests/fixtures/packs/pack_with_rules/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2reactor/tests/fixtures/packs/pack_with_sensor/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/aliases/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/backstop/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/descendants/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/generic/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/localrunner_pack/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
3 changes: 1 addition & 2 deletions st2tests/st2tests/fixtures/packs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# instructions on how to checkout the submodules if they are not checked out.
# The test_content_version* targets are dependencies of ./test_content_version_fixture

# pack_metadata_in_git_submodule(
resources(
pack_metadata_in_git_submodule(
name="test_content_version_metadata",
sources=[
"test_content_version/pack.yaml",
Expand Down
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/action_chain_tests/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_1/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_1.yaml",
],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_10/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_11/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_11.yaml",
],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_12/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_13/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_14/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_15/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_16/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_17/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_18/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_19/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_19.yaml",
],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_2/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
pack_metadata(
name="metadata",
)

resource(
name="pack_requirements",
source="requirements.txt",
)

python_sources()
python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_20/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_21/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_22/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_22.yaml",
],
)
10 changes: 9 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_23/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
python_sources()
# There are no metadata files in dummy_pack_23 yet.
# It is used in the pack copy tests.
# pack_metadata(
# name="metadata",
# )

python_sources(
# dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_3/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_4/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_5/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_5.yaml",
],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_6/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_6.yaml",
],
)
5 changes: 5 additions & 0 deletions st2tests/st2tests/fixtures/packs/dummy_pack_7/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[
":metadata",
"st2tests/st2tests/fixtures/packs/configs/dummy_pack_7.yaml",
],
)
8 changes: 7 additions & 1 deletion st2tests/st2tests/fixtures/packs/dummy_pack_8/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
pack_metadata(
name="metadata",
)

python_sources(
dependencies=[":metadata"],
)
Loading

0 comments on commit 6e773e6

Please sign in to comment.