Skip to content

Commit 525a803

Browse files
authored
Remove dead output_config_dir from dd_agent_pkg_mklink (#53856)
### What does this PR do? Drop `_output_config_dir` and its `DEFAULT_OUTPUT_CONFIG_DIR` default from `bazel/rules/dd_agent_pkg_mklink.bzl`. ### Motivation Bazel's dependency tracking has no visibility into whether a read build-setting value is ever actually used in a rule's output. Merely calling `ctx.attr._output_config_dir` and reading its `BuildSettingInfo` registers a real dependency on `--//:output_config_dir`, forcing re-analysis of every `dd_agent_pkg_mklink` target whenever that flag's value changes, even though the substitution it feeds is never consumed. The flag itself, `//:output_config_dir`, stays alive and used elsewhere (`dd_agent_expand_template.bzl`). Only this rule's dead, never-exercised dependency on it goes away. ### Additional Notes Found by working on: - #53850. Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
1 parent 7f9d2a8 commit 525a803

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

bazel/rules/dd_agent_pkg_mklink.bzl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ load("@agent_volatile//:env_vars.bzl", "env_vars")
44
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
55
load("@rules_pkg//pkg:providers.bzl", "PackageSymlinkInfo")
66

7-
# The place we will install to if we run bazel pkg_install without a destdir
8-
# We use /tmp for lack of a better safe space.
9-
DEFAULT_OUTPUT_CONFIG_DIR = "/tmp"
10-
117
# The location where the product should be installed on a user system.
128
DEFAULT_PRODUCT_DIR = "/opt/datadog-agent"
139

@@ -17,11 +13,6 @@ def _dd_agent_pkg_mklink_impl(ctx):
1713

1814
# TODO: Consider sharing common logic with dd_agent_expand_template IFF we find
1915
# the alignment in variable names gets larger.
20-
# TODO: should this be different for windows? Or should we have different variables for windows?
21-
subs["output_config_dir"] = DEFAULT_OUTPUT_CONFIG_DIR
22-
if ctx.attr._output_config_dir and BuildSettingInfo in ctx.attr._output_config_dir:
23-
output_config_dir = ctx.attr._output_config_dir[BuildSettingInfo].value.rstrip("/")
24-
subs["output_config_dir"] = output_config_dir
2516
subs["install_dir"] = DEFAULT_PRODUCT_DIR
2617
if ctx.attr._install_dir and BuildSettingInfo in ctx.attr._install_dir:
2718
install_dir = ctx.attr._install_dir[BuildSettingInfo].value
@@ -53,7 +44,6 @@ some default substitutions which are computed from the build environment.
5344
5445
Default substitutions:
5546
{install_dir}: The value of the flag //:install_dir
56-
{output_config_dir}: The value of the flag //:output_config_dir
5747
{build_version}: The pipeline build version.
5848
""",
5949
attrs = {
@@ -70,6 +60,5 @@ Default substitutions:
7060
default = "{}", # Empty JSON
7161
),
7262
"_install_dir": attr.label(default = "@@//:install_dir"),
73-
"_output_config_dir": attr.label(default = "@@//:output_config_dir"),
7463
},
7564
)

0 commit comments

Comments
 (0)