Skip to content

Commit

Permalink
Read extension details from Ruby file
Browse files Browse the repository at this point in the history
Instead of writing a YAML file for every agent release, and then reading
and parsing it on installation, directly write a Ruby file that can be
more easily imported.

This reduces our dependency on YAML library during installation.

Part of #904
  • Loading branch information
tombruijn committed Jan 20, 2023
1 parent e20f4e2 commit 51bacd7
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 109 deletions.
144 changes: 144 additions & 0 deletions ext/agent.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# DO NOT EDIT
# This is a generated file by the `rake ship` family of tasks in the
# appsignal-agent repository.
# Modifications to this file will be overwritten with the next agent release.

APPSIGNAL_AGENT_CONFIG = {
"version" => "c0e80b9",
"mirrors" => [
"https://appsignal-agent-releases.global.ssl.fastly.net",
"https://d135dj0rjqvssy.cloudfront.net"
],
"triples" => {
"x86_64-darwin" => {
"static" => {
"checksum" => "c0e1fc966eff49dd942ed07b44f5c5db6be41676f4e35530c300bac8f99e03c4",
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "38805c50262c9dbc5c4e7479d274b5e41d6df6e86e6c09d76b9f3f471dcf8787",
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
}
},
"universal-darwin" => {
"static" => {
"checksum" => "c0e1fc966eff49dd942ed07b44f5c5db6be41676f4e35530c300bac8f99e03c4",
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "38805c50262c9dbc5c4e7479d274b5e41d6df6e86e6c09d76b9f3f471dcf8787",
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
}
},
"aarch64-darwin" => {
"static" => {
"checksum" => "37fcdf17250ce9e2149f28a8492074f5957691636ab542c7073b323a1b9dbdd8",
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "0fe962abf0885888f38d1767b959ea25ea8c4b38813d7a23fbebe2aa62873341",
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
}
},
"arm64-darwin" => {
"static" => {
"checksum" => "37fcdf17250ce9e2149f28a8492074f5957691636ab542c7073b323a1b9dbdd8",
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "0fe962abf0885888f38d1767b959ea25ea8c4b38813d7a23fbebe2aa62873341",
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
}
},
"arm-darwin" => {
"static" => {
"checksum" => "37fcdf17250ce9e2149f28a8492074f5957691636ab542c7073b323a1b9dbdd8",
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "0fe962abf0885888f38d1767b959ea25ea8c4b38813d7a23fbebe2aa62873341",
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
}
},
"aarch64-linux" => {
"static" => {
"checksum" => "ce9075ee5bc14ea786b734793b6bb6331567398cab6a21f2ceaa9062cfbdb373",
"filename" => "appsignal-aarch64-linux-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "eb798538e0e32b19de0afba924c3cb8979a5e57433de4b1a12a6aeaf7233929b",
"filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
}
},
"i686-linux" => {
"static" => {
"checksum" => "ea3d1a29cf1534293738f2bd27ae29b8addf8dbe34dde77dc4ae150e109e2e4f",
"filename" => "appsignal-i686-linux-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "add159ec5bcf1b1a3362c08f9f765230d99c0431c567d845e31c51389792a51c",
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
}
},
"x86-linux" => {
"static" => {
"checksum" => "ea3d1a29cf1534293738f2bd27ae29b8addf8dbe34dde77dc4ae150e109e2e4f",
"filename" => "appsignal-i686-linux-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "add159ec5bcf1b1a3362c08f9f765230d99c0431c567d845e31c51389792a51c",
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
}
},
"x86_64-linux" => {
"static" => {
"checksum" => "adeceb091c4ed277c29eda018ffc61fd064e5c486b2b0a239b26873168a7fdb0",
"filename" => "appsignal-x86_64-linux-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "121abc5d34db302c130cf49ce1dad032025e6717efd63f5cf04ba0b55b5fc863",
"filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
}
},
"x86_64-linux-musl" => {
"static" => {
"checksum" => "b57aec8c334b1d3646c80d87f20372287e4e2bdbd798c195e0e36ceeb2aac68a",
"filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "67a918b1848f979afe01eb56ce1661fb5b5910d4c7d691fcf0e304203bd7bd7a",
"filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
}
},
"aarch64-linux-musl" => {
"static" => {
"checksum" => "fc780524942fc7aeaa4cabec64dfc104c82969df7e8b5cd0fa8eae24c1c9b304",
"filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "92ed33ca9f402f9e822e5777b291f7a062545767ea92dea7eaa94db4f82d8130",
"filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
}
},
"x86_64-freebsd" => {
"static" => {
"checksum" => "574137de415487afe8d2cc29eac3b1fda2c8e1001474b8f25ebee0cbb32fb1ca",
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "9dcc3454c14e8a7a0d7250b35864b6f0f205d5c730ca510e7b77628e024a703f",
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
}
},
"amd64-freebsd" => {
"static" => {
"checksum" => "574137de415487afe8d2cc29eac3b1fda2c8e1001474b8f25ebee0cbb32fb1ca",
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
},
"dynamic" => {
"checksum" => "9dcc3454c14e8a7a0d7250b35864b6f0f205d5c730ca510e7b77628e024a703f",
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
}
}
}
}.freeze
101 changes: 0 additions & 101 deletions ext/agent.yml

This file was deleted.

5 changes: 2 additions & 3 deletions ext/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
require "open-uri"
require "zlib"
require "json"
require "yaml"
require "rubygems/package"
require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
require_relative "./agent"

EXT_PATH = File.expand_path("..", __FILE__).freeze
AGENT_CONFIG = YAML.load(File.read(File.join(EXT_PATH, "agent.yml"))).freeze
EXT_PATH = File.expand_path("..", __FILE__).freeze

AGENT_PLATFORM = Appsignal::System.agent_platform
AGENT_ARCHITECTURE = Appsignal::System.agent_architecture
Expand Down
7 changes: 2 additions & 5 deletions lib/appsignal/extension.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "yaml"

begin
if Appsignal::System.jruby?
require "appsignal/extension/jruby"
Expand All @@ -24,9 +22,8 @@ module Appsignal
class Extension
class << self
def agent_config
@agent_config ||= YAML.load(
File.read(File.join(File.dirname(__FILE__), "../../ext/agent.yml"))
)
require_relative "../../ext/agent"
::APPSIGNAL_AGENT_CONFIG
end

def agent_version
Expand Down

0 comments on commit 51bacd7

Please sign in to comment.