From 11ee87ca9eed5c7d0c5bded66231eaf088d6f215 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 15 Aug 2024 11:30:14 +0200 Subject: [PATCH] Fail pipeline when libdatadog.so is missing --- .gitlab/install_datadog_deps.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab/install_datadog_deps.rb b/.gitlab/install_datadog_deps.rb index 21f9118f144..e5b755b0a85 100755 --- a/.gitlab/install_datadog_deps.rb +++ b/.gitlab/install_datadog_deps.rb @@ -74,7 +74,7 @@ 'ffi', 'libddwaf', 'msgpack', - 'libdatadog', # libdatadog MUST be installed before datadog + 'libdatadog', # libdatadog MUST be installed before datadog to ensure libdatadog native extension is compiled 'datadog', ].each do |gem| version = gem_version_mapping.delete(gem) @@ -108,6 +108,12 @@ raise "#{gem_version_mapping.keys.join(',')} are not installed." if gem_version_mapping.any? +datadog_gem_path = versioned_path.join("gems/datadog-#{ENV.fetch('DATADOG_GEM_LOCATION')}") +libdatadog_so_file = "libdatadog_api.#{RUBY_VERSION[/\d+.\d+/]}_#{RUBY_PLATFORM}.so" +unless File.exist?("#{datadog_gem_path}/lib/#{libdatadog_so_file}") + raise "Missing #{libdatadog_so_file} in #{datadog_gem_path}." +end + FileUtils.cd(versioned_path.join("extensions/#{Gem::Platform.local}"), verbose: true) do # Symlink those directories to be utilized by Ruby compiled with shared libraries FileUtils.ln_sf Gem.extension_api_version, ruby_api_version