Skip to content

Commit 17359fe

Browse files
authored
Merge pull request #5846: pants: register assets (like conf files) and dependencies on them
pants: register assets (like conf files) and dependencies on them
2 parents ebaf307 + e0119dc commit 17359fe

File tree

63 files changed

+528
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+528
-36
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Added
1414
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
1515
to pants' use of PEX lockfiles. This is not a user-facing addition.
1616
#5778 #5789 #5817 #5795 #5830 #5833 #5834 #5841 #5840 #5838 #5842 #5837 #5849 #5850
17+
#5846
1718
Contributed by @cognifloyd
1819

1920
* Added a joint index to solve the problem of slow mongo queries for scheduled executions. #5805

conf/BUILD

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
file(
2+
name="st2client_sample_config",
3+
source="st2rc.sample.ini",
4+
)
5+
6+
file(
7+
name="st2.conf.sample",
8+
source="st2.conf.sample",
9+
)
10+
11+
file(
12+
name="logrotate",
13+
source="logrotate.conf",
14+
)
15+
16+
file(
17+
name="nginx_sample_config",
18+
source="nginx/st2.conf",
19+
)
20+
21+
file(
22+
name="st2_kvstore_demo_crypto_key",
23+
source="st2_kvstore_demo.crypto.key.json",
24+
)
25+
26+
files(
27+
name="st2_tests_conf",
28+
sources=[
29+
"st2.tests*.conf",
30+
],
31+
dependencies=[
32+
"st2auth/conf:htpasswd",
33+
"st2actions/conf:logging",
34+
"st2reactor/conf:logging",
35+
"st2tests/conf:other_logging_conf",
36+
],
37+
)
38+
39+
file(
40+
name="st2_dev_conf",
41+
source="st2.dev.conf",
42+
dependencies=[
43+
":st2_kvstore_demo_crypto_key",
44+
"st2auth/conf:htpasswd",
45+
"st2actions/conf:logging",
46+
"st2api/conf:logging",
47+
"st2auth/conf:logging",
48+
"st2reactor/conf:logging",
49+
"st2stream/conf:logging",
50+
],
51+
)
52+
53+
file(
54+
name="st2_package_conf",
55+
source="st2.package.conf",
56+
)

contrib/chatops/tests/BUILD

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
files(
2+
name="fixtures",
3+
sources=["fixtures/*.json"],
4+
)
5+
16
python_tests(
7+
name="tests",
8+
dependencies=[":fixtures"],
29
skip_pylint=True,
310
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
files(
2+
name="powershell",
3+
sources=["*.ps1"],
4+
)
5+
6+
python_sources(
7+
dependencies=[":powershell"],
8+
)
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
python_sources()
1+
resource(
2+
name="runner_metadata",
3+
source="runner.yaml",
4+
)
5+
6+
python_sources(
7+
dependencies=[":runner_metadata"],
8+
)

scripts/github/BUILD

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
shell_sources()
1+
files(
2+
name="assets",
3+
sources=[
4+
"*.txt",
5+
"*.conf",
6+
],
7+
)
8+
9+
shell_sources(
10+
dependencies=[":assets"],
11+
)

st2actions/conf/BUILD

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
file(
2+
name="logging_console",
3+
source="console.conf",
4+
)
5+
6+
files(
7+
name="logging",
8+
sources=["logging*.conf"],
9+
)
10+
11+
files(
12+
name="logging_syslog",
13+
sources=["syslog*.conf"],
14+
)

st2api/conf/BUILD

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
file(
2+
name="logging_console",
3+
source="console.conf",
4+
)
5+
6+
file(
7+
name="logging",
8+
source="logging.conf",
9+
)
10+
11+
file(
12+
name="logging_gunicorn",
13+
source="logging.gunicorn.conf",
14+
)
15+
16+
file(
17+
name="logging_syslog",
18+
source="syslog.conf",
19+
)

st2api/st2api/public/BUILD

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
files(
2+
sources=[
3+
"images/*.png",
4+
],
5+
)

st2api/st2api/templates/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file(source="index.html")

st2api/tests/integration/BUILD

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
python_tests(
22
name="tests",
3+
dependencies=[
4+
"conf/st2.tests.conf:st2_tests_conf",
5+
],
36
)

st2auth/conf/BUILD

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
file(
2+
name="apache_sample_conf",
3+
source="apache.sample.conf",
4+
)
5+
6+
file(
7+
name="htpasswd",
8+
source="htpasswd_dev",
9+
)
10+
11+
file(
12+
name="logging_console",
13+
source="console.conf",
14+
)
15+
16+
file(
17+
name="logging",
18+
source="logging.conf",
19+
)
20+
21+
file(
22+
name="logging_gunicorn",
23+
source="logging.gunicorn.conf",
24+
)
25+
26+
file(
27+
name="logging_syslog",
28+
source="syslog.conf",
29+
)

st2client/tests/fixtures/BUILD

+13-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
python_sources()
1+
resources(
2+
name="execution_fixtures",
3+
sources=["execution*.json", "execution*.txt"],
4+
)
5+
6+
resources(
7+
name="st2client_ini",
8+
sources=["*.ini"],
9+
)
10+
11+
python_sources(
12+
dependencies=[":execution_fixtures"],
13+
)

st2client/tests/unit/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
python_tests(
22
name="tests",
33
dependencies=[
4+
"st2client/tests/fixtures:st2client_ini",
45
# most files import tests.base which is ambiguous. Tell pants which one to use.
56
"st2client/tests/base.py",
67
],
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
files(
2+
sources=["*.json"],
3+
)

st2common/benchmarks/micro/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
python_sources(
2+
dependencies=["st2common/benchmarks/fixtures/json"],
23
skip_pylint=True,
34
)
45

st2common/st2common/BUILD

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
python_sources()
1+
python_sources(
2+
dependencies=[
3+
":openapi_spec",
4+
]
5+
)
6+
7+
# These may be loaded with st2common.util.spec_loader
8+
resources(
9+
name="openapi_spec",
10+
sources=["openapi.yaml", "openapi.yaml.j2"],
11+
)

st2common/st2common/bootstrap/BUILD

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
python_sources()
1+
python_sources(
2+
overrides={
3+
"policiesregistrar.py": {
4+
"dependencies": [
5+
"st2common/st2common/policies/meta:policies_meta",
6+
],
7+
},
8+
},
9+
)

st2common/st2common/conf/BUILD

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# used in st2common.constants.logging.DEFAULT_LOGGING_CONF_PATH
2+
resource(
3+
name="base.logging.conf",
4+
source="base.logging.conf",
5+
)

st2common/st2common/constants/BUILD

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
python_sources()
1+
python_sources(
2+
dependencies=[
3+
"st2common/st2common/conf:base.logging.conf",
4+
]
5+
)
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These are loaded by st2common.bootstrap.policiesregistrar
2+
resources(
3+
name="policies_meta",
4+
sources=["*.yaml"],
5+
)

st2common/st2common/util/schema/BUILD

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
python_sources()
1+
python_sources(
2+
dependencies=[
3+
":jsonschema",
4+
]
5+
)
6+
7+
resources(
8+
name="jsonschema",
9+
sources=["*.json"],
10+
)

st2common/tests/integration/BUILD

+5
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@ python_sources()
22

33
python_tests(
44
name="tests",
5+
dependencies=[
6+
# used by test_register_content_script
7+
"conf/st2.tests.conf:st2_tests_conf",
8+
"conf/st2.tests1.conf:st2_tests_conf",
9+
],
510
)

st2common/tests/unit/test_util_file_system.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def test_get_file_list(self):
3434
"mock_exception.py",
3535
"concurrency.py",
3636
"__init__.py",
37+
"meta/BUILD",
3738
"meta/mock_exception.yaml",
3839
"meta/concurrency.yaml",
3940
"meta/__init__.py",
@@ -49,6 +50,6 @@ def test_get_file_list(self):
4950
"meta/__init__.py",
5051
]
5152
result = get_file_list(
52-
directory=directory, exclude_patterns=["*.pyc", "*.yaml", "BUILD"]
53+
directory=directory, exclude_patterns=["*.pyc", "*.yaml", "*BUILD"]
5354
)
5455
self.assertItemsEqual(expected, result)

0 commit comments

Comments
 (0)