Skip to content

Commit

Permalink
share system_probe enablement conditions in an helper
Browse files Browse the repository at this point in the history
  • Loading branch information
chouquette committed Nov 12, 2024
1 parent ca2705f commit e194084
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion omnibus/config/projects/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This product includes software developed at Datadog (https:#www.datadoghq.com/).
# Copyright 2016-present Datadog, Inc.
require "./lib/ostools.rb"
require "./lib/project_helpers.rb"
flavor = ENV['AGENT_FLAVOR']
output_config_dir = ENV["OUTPUT_CONFIG_DIR"]

Expand Down Expand Up @@ -222,7 +223,7 @@
dependency 'datadog-agent'

# System-probe
if linux_target? && !heroku_target?
if sysprobe_enabled?
dependency 'system-probe'
end

Expand Down
5 changes: 2 additions & 3 deletions omnibus/config/software/datadog-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Copyright 2016-present Datadog, Inc.

require './lib/ostools.rb'
require './lib/project_helpers.rb'
require 'pathname'

name 'datadog-agent'
Expand Down Expand Up @@ -144,9 +145,7 @@
end

# System-probe
sysprobe_support = (not heroku_target?) && (linux_target? || (windows_target? && do_windows_sysprobe != "")) &&
ENV.has_key?('SYSTEM_PROBE_BIN') and not ENV['SYSTEM_PROBE_BIN'].empty?
if sysprobe_support
if sysprobe_enabled? || (windows_target? && do_windows_sysprobe != "")
if not bundled_agents.include? "system-probe"
if windows_target?
command "invoke -e system-probe.build", env: env
Expand Down
4 changes: 3 additions & 1 deletion omnibus/config/software/system-probe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

name 'system-probe'

require './lib/project_helpers.rb'

source path: '..'
relative_path 'src/github.com/DataDog/datadog-agent'

Expand All @@ -21,7 +23,7 @@
mkdir "#{install_dir}/embedded/share/system-probe/ebpf/co-re/btf"
mkdir "#{install_dir}/embedded/share/system-probe/java"

if ENV.has_key?('SYSTEM_PROBE_BIN') and not ENV['SYSTEM_PROBE_BIN'].empty?
if sysprobe_enabled?
arch = `uname -m`.strip
if arch == "aarch64"
arch = "arm64"
Expand Down
12 changes: 12 additions & 0 deletions omnibus/lib/project_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Profect related helpers
#

require './lib/ostools.rb'

def sysprobe_enabled?()
# This doesn't account for Windows special case which build system probe as part of the
# agent build process
return not heroku_target? && linux_target? && ENV.fetch('SYSTEM_PROBE_BIN', '').empty?
end

0 comments on commit e194084

Please sign in to comment.