Skip to content

Commit 3e952e7

Browse files
authored
Pantsbuild: Add BUILD dependencies for logging.conf (#6251)
2 parents a5f4d1a + 1180d1a commit 3e952e7

File tree

10 files changed

+72
-22
lines changed

10 files changed

+72
-22
lines changed

BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@ file(
5151
shell_sources(
5252
name="root",
5353
)
54+
55+
file(
56+
name="logs_directory",
57+
source="logs/.gitignore",
58+
)

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Added
5959
* Continue introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
6060
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
6161
to pants' use of PEX lockfiles. This is not a user-facing addition.
62-
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244
62+
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251
6363
Contributed by @cognifloyd
6464
* Build of ST2 EL9 packages #6153
6565
Contributed by @amanda11

pants-plugins/macros.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,34 @@ def st2_shell_sources_and_resources(**kwargs):
125125

126126
kwargs["name"] += "_resources"
127127
resources(**kwargs) # noqa: F821
128+
129+
130+
# these are referenced by the logging.*.conf files.
131+
_st2common_logging_deps = (
132+
"//st2common/st2common/log.py",
133+
"//st2common/st2common/logging/formatters.py",
134+
)
135+
136+
137+
def st2_logging_conf_files(**kwargs):
138+
"""This creates a files target with logging dependencies."""
139+
deps = kwargs.pop("dependencies", []) or []
140+
deps = list(deps) + list(_st2common_logging_deps)
141+
kwargs["dependencies"] = tuple(deps)
142+
files(**kwargs) # noqa: F821
143+
144+
145+
def st2_logging_conf_file(**kwargs):
146+
"""This creates a file target with logging dependencies."""
147+
deps = kwargs.pop("dependencies", []) or []
148+
deps = list(deps) + list(_st2common_logging_deps)
149+
kwargs["dependencies"] = tuple(deps)
150+
file(**kwargs) # noqa: F821
151+
152+
153+
def st2_logging_conf_resources(**kwargs):
154+
"""This creates a resources target with logging dependencies."""
155+
deps = kwargs.pop("dependencies", []) or []
156+
deps = list(deps) + list(_st2common_logging_deps)
157+
kwargs["dependencies"] = tuple(deps)
158+
resources(**kwargs) # noqa: F821

st2actions/conf/BUILD

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
file(
1+
st2_logging_conf_file(
22
name="logging_console",
33
source="console.conf",
44
)
55

6-
files(
6+
st2_logging_conf_files(
77
name="logging",
88
sources=["logging*.conf"],
9+
dependencies=["//:logs_directory"],
910
overrides={
1011
"logging.conf": dict(
1112
dependencies=[
13+
"//:logs_directory",
1214
"//:reqs#python-json-logger",
1315
],
1416
),
1517
},
1618
)
1719

18-
files(
20+
st2_logging_conf_files(
1921
name="logging_syslog",
2022
sources=["syslog*.conf"],
2123
)

st2api/conf/BUILD

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
file(
1+
st2_logging_conf_file(
22
name="logging_console",
33
source="console.conf",
44
)
55

6-
file(
6+
st2_logging_conf_file(
77
name="logging",
88
source="logging.conf",
9+
dependencies=["//:logs_directory"],
910
)
1011

11-
file(
12+
st2_logging_conf_file(
1213
name="logging_gunicorn",
1314
source="logging.gunicorn.conf",
15+
dependencies=["//:logs_directory"],
1416
)
1517

16-
file(
18+
st2_logging_conf_file(
1719
name="logging_syslog",
1820
source="syslog.conf",
1921
)

st2auth/conf/BUILD

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ file(
88
source="htpasswd_dev",
99
)
1010

11-
file(
11+
st2_logging_conf_file(
1212
name="logging_console",
1313
source="console.conf",
1414
)
1515

16-
file(
16+
st2_logging_conf_file(
1717
name="logging",
1818
source="logging.conf",
19+
dependencies=["//:logs_directory"],
1920
)
2021

21-
file(
22+
st2_logging_conf_file(
2223
name="logging_gunicorn",
2324
source="logging.gunicorn.conf",
25+
dependencies=["//:logs_directory"],
2426
)
2527

26-
file(
28+
st2_logging_conf_file(
2729
name="logging_syslog",
2830
source="syslog.conf",
2931
)

st2reactor/conf/BUILD

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
file(
1+
st2_logging_conf_file(
22
name="logging_console",
33
source="console.conf",
44
)
55

6-
files(
6+
st2_logging_conf_files(
77
name="logging",
88
sources=["logging*.conf"],
9+
dependencies=["//:logs_directory"],
910
)
1011

11-
files(
12+
st2_logging_conf_files(
1213
name="logging_syslog",
1314
sources=["syslog*.conf"],
1415
)

st2stream/conf/BUILD

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
file(
1+
st2_logging_conf_file(
22
name="logging_console",
33
source="console.conf",
44
)
55

6-
file(
6+
st2_logging_conf_file(
77
name="logging",
88
source="logging.conf",
9+
dependencies=["//:logs_directory"],
910
)
1011

11-
file(
12+
st2_logging_conf_file(
1213
name="logging_gunicorn",
1314
source="logging.gunicorn.conf",
15+
dependencies=["//:logs_directory"],
1416
)
1517

16-
file(
18+
st2_logging_conf_file(
1719
name="logging_syslog",
1820
source="syslog.conf",
1921
)

st2tests/conf/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ file(
88
source="st2_kvstore_tests.crypto.key.json",
99
)
1010

11-
file(
11+
st2_logging_conf_file(
1212
name="logging.conf",
1313
source="logging.conf",
1414
)
1515

16-
files(
16+
st2_logging_conf_files(
1717
name="other_logging_conf",
1818
sources=["logging.*.conf"],
1919
)

st2tests/st2tests/fixtures/conf/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
st2_logging_conf_resources(
2+
name="logging",
3+
sources=["logging.*.conf"],
4+
)
5+
16
resources(
27
name="st2.tests.conf",
38
sources=[
49
"st2.tests*.conf",
5-
"logging.*.conf", # used by st2.tests*.conf
610
],
711
dependencies=[
12+
":logging", # used by st2.tests*.conf
813
"st2tests/conf:other_logging_conf",
914
# depending on st2auth from st2tests is not nice.
1015
"st2auth/conf:htpasswd",

0 commit comments

Comments
 (0)