Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newrelic-infra-agent 1.20.0 (new formula) #82746

Closed
wants to merge 13 commits into from
46 changes: 46 additions & 0 deletions Formula/newrelic-infra-agent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
class NewrelicInfraAgent < Formula
desc "New Relic infrastructure agent"
homepage "https://github.com/newrelic/infrastructure-agent"
url "https://github.com/newrelic/infrastructure-agent/archive/refs/tags/1.20.0.tar.gz"
sha256 "0ea19d1e70b7c9204bfe5aeb7803b4c3c6b0942036f8680ae52ae76d85e2fa68"
license "Apache-2.0"
head "https://github.com/newrelic/infrastructure-agent.git"

depends_on "go" => :build
carlocab marked this conversation as resolved.
Show resolved Hide resolved
depends_on arch: :x86_64
brushknight marked this conversation as resolved.
Show resolved Hide resolved

def install
goarch = Hardware::CPU.arm? ? "arm64" : "amd64"
ENV["VERSION"] = version.to_s
os = "darwin"
ENV["CGO_ENABLED"] = "1"
on_linux do
os = "linux"
ENV["CGO_ENABLED"] = "0"
end
ENV["GOOS"] = os
system "make", "dist-for-os"
bin.install "dist/#{os}-newrelic-infra_#{os}_#{goarch}/newrelic-infra"
bin.install "dist/#{os}-newrelic-infra-ctl_#{os}_#{goarch}/newrelic-infra-ctl"
bin.install "dist/#{os}-newrelic-infra-service_#{os}_#{goarch}/newrelic-infra-service"
on_macos do
(var/"db/newrelic-infra").install "assets/licence/LICENSE.macos.txt"
end
end

def post_install
(etc/"newrelic-infra").mkpath
(var/"log/newrelic-infra").mkpath
end

service do
run [bin/"newrelic-infra-service", "-config", etc/"newrelic-infra/newrelic-infra.yml"]
log_path var/"log/newrelic-infra/newrelic-infra.log"
error_log_path var/"log/newrelic-infra/newrelic-infra.stderr.log"
end

test do
output = shell_output("#{bin}/newrelic-infra -validate")
assert_match "config validation", output
end
end