Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions compliance/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ py_binary(
deps = ["//tasks:licenses"],
)

filegroup(
name = "all_agent_deps",
srcs = [
"//deps:all_deps",
] + select({
"//packages/agent:linux_heroku": [],
"//conditions:default": [
# This will become "//deps/openscap:all_deps" in the future
"@popt",
],
}),
)

# Gather the licenses for dependencies that not built by omnibus any more.
# The target is a temporary hack. In the future, it should become //distrib:agent.
license_csv(
Expand All @@ -20,7 +33,7 @@ license_csv(
licenses_dir = "licenses_dir",
offers_dir = "sources_dir",
tags = ["manual"],
target = "//deps:all_deps",
target = ":all_agent_deps",
)

# Turn the copied licenses into a target we can feed to other rules.
Expand Down Expand Up @@ -62,7 +75,7 @@ filter_directory(
strip_prefix = ".",
)

# You would expect that filter_directory returns something usuable to pkg_* rules.
# You would expect that filter_directory returns something usable to pkg_* rules.
# It does not, so we have to wrap it.
pkg_files(
name = "offer_copies",
Expand Down
1 change: 0 additions & 1 deletion deps/BUILD.bazel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to have this list of dependencies moved in compliance:all_agent_deps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the deps in compliance is sort of temporary. That should become just rules some day, with the dependency list coming from the package, like in #44033.

The end goal is that //packages/debian/install_dir has the licenses_csv rule, with. //packages/debian:all_deps as input, and //packages/debian:agent_deb depends on //packages/debian/install_dir:all_files. //compliance will only hold rule definitions and tests for global constraints, like correctness of LICENSES-3rdparty.csv.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ filegroup(
"@libxslt",
"@nghttp2",
"@pcre2",
"@popt",
"@zstd",
],
"//:macos_arm64": [
Expand Down
5 changes: 4 additions & 1 deletion omnibus/config/software/datadog-agent-finalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
# TODO too many things done here, should be split
block do
# Push all the pieces built with Bazel.
command_on_repo_root "bazelisk run -- //packages/install_dir:install --destdir=#{install_dir}", env: {"BUILD_WORKSPACE_DIRECTORY" => "." }

# TODO: flavor can be defaulted and set from the bazel wrapper based on the environment.
command_on_repo_root "bazelisk run --//:install_dir=#{install_dir} --//packages/agent:flavor=#{flavor_arg} -- //packages/install_dir:install"

# Conf files
if windows_target?
Expand Down Expand Up @@ -64,6 +66,7 @@
delete "#{install_dir}/embedded/include/dbus-1.0"
end

# TODO: Rather than move these, let's install them to the right place to start
if linux_target?
# Move configuration files
mkdir "#{output_config_dir}/etc/datadog-agent"
Expand Down
45 changes: 45 additions & 0 deletions packages/agent/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Agent packages

load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")

package(default_visibility = ["//visibility:public"])

string_flag(
name = "flavor",
build_setting_default = "base",
# These values match omnibus.
values = [
"base",
"fips",
"heroku",
],
)

alias(
name = "default_flavor",
actual = ":base_flavor",
)

config_setting(
name = "base_flavor",
flag_values = {"@@//packages/agent:flavor": "base"},
)

config_setting(
name = "fips_flavor",
flag_values = {"@@//packages/agent:flavor": "fips"},
)

config_setting(
name = "heroku_flavor",
flag_values = {"@@//packages/agent:flavor": "heroku"},
)

selects.config_setting_group(
name = "linux_heroku",
match_all = [
":heroku_flavor",
"@platforms//os:linux",
],
)
18 changes: 17 additions & 1 deletion packages/install_dir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,27 @@ pkg_filegroup(
}),
)

# All the things that belong in /etc
# This is not strictly in install_dir but it is a cousin.
# TODO: split this cleanly. The way the omnibus script works
# is to install everything into install_dir (/opt/datadog-agent)
# and then bulk move things to {output_dir}/etc/ in the finalizer.
# We need to fix that so we just generate to the right place. For
# now, let's just try to keep etc things separate.
pkg_filegroup(
name = "etc",
srcs = [
"//deps/snmp_traps:all_files",
],
)

# Gather everything that goes in /opt/datadog-agent/...
pkg_install(
name = "install",
srcs = [
":embedded",
":etc",
":licenses",
"//deps/snmp_traps:all_files",
],
destdir_flag = "//:install_dir",
)