From 51bacd7bc72302173c5ddb6904cad589617b7268 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Thu, 19 Jan 2023 16:04:10 +0100 Subject: [PATCH] Read extension details from Ruby file 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 --- ext/agent.rb | 144 +++++++++++++++++++++++++++++++++++++ ext/agent.yml | 101 -------------------------- ext/base.rb | 5 +- lib/appsignal/extension.rb | 7 +- 4 files changed, 148 insertions(+), 109 deletions(-) create mode 100644 ext/agent.rb delete mode 100644 ext/agent.yml diff --git a/ext/agent.rb b/ext/agent.rb new file mode 100644 index 000000000..e13527553 --- /dev/null +++ b/ext/agent.rb @@ -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 diff --git a/ext/agent.yml b/ext/agent.yml deleted file mode 100644 index 54544c87f..000000000 --- a/ext/agent.yml +++ /dev/null @@ -1,101 +0,0 @@ -# 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. ---- -version: 9b62288 -mirrors: -- https://appsignal-agent-releases.global.ssl.fastly.net -- https://d135dj0rjqvssy.cloudfront.net -triples: - x86_64-darwin: - static: - checksum: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca - filename: appsignal-x86_64-darwin-all-static.tar.gz - dynamic: - checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31 - filename: appsignal-x86_64-darwin-all-dynamic.tar.gz - universal-darwin: - static: - checksum: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca - filename: appsignal-x86_64-darwin-all-static.tar.gz - dynamic: - checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31 - filename: appsignal-x86_64-darwin-all-dynamic.tar.gz - aarch64-darwin: - static: - checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a - filename: appsignal-aarch64-darwin-all-static.tar.gz - dynamic: - checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9 - filename: appsignal-aarch64-darwin-all-dynamic.tar.gz - arm64-darwin: - static: - checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a - filename: appsignal-aarch64-darwin-all-static.tar.gz - dynamic: - checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9 - filename: appsignal-aarch64-darwin-all-dynamic.tar.gz - arm-darwin: - static: - checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a - filename: appsignal-aarch64-darwin-all-static.tar.gz - dynamic: - checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9 - filename: appsignal-aarch64-darwin-all-dynamic.tar.gz - aarch64-linux: - static: - checksum: 0e5d89aeda1e883c912ff069bb76029a1e3cad69f493865d877ffaffa2b45142 - filename: appsignal-aarch64-linux-all-static.tar.gz - dynamic: - checksum: 58b09bf6ca7761a4d68cd9de87a0bb45b3465ace90b62a88d9fe77f629c26d7d - filename: appsignal-aarch64-linux-all-dynamic.tar.gz - i686-linux: - static: - checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61 - filename: appsignal-i686-linux-all-static.tar.gz - dynamic: - checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59' - filename: appsignal-i686-linux-all-dynamic.tar.gz - x86-linux: - static: - checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61 - filename: appsignal-i686-linux-all-static.tar.gz - dynamic: - checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59' - filename: appsignal-i686-linux-all-dynamic.tar.gz - x86_64-linux: - static: - checksum: 0b6fe4b343461a1a906fc73edb44bc5b12c75214d21fc81ed26d3eb88588003e - filename: appsignal-x86_64-linux-all-static.tar.gz - dynamic: - checksum: 82117daf3e1c550526f74f4ec66c403bed22aa8600459b749858814589ed688b - filename: appsignal-x86_64-linux-all-dynamic.tar.gz - x86_64-linux-musl: - static: - checksum: b3f52d7a7a1f4ae8095dd5b1207270dc1797766820d925aca0d09133983c9163 - filename: appsignal-x86_64-linux-musl-all-static.tar.gz - dynamic: - checksum: 5de9ddc90fc5beb308eadd5381ac0360692cb32e58dcaf0b0d7ecd3dabf44499 - filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz - aarch64-linux-musl: - static: - checksum: d306c50cc9f1bc8ea3339b4185b2a60a1c27f17d9067a529b1889d74c6c0a8d6 - filename: appsignal-aarch64-linux-musl-all-static.tar.gz - dynamic: - checksum: e3015e05a807ef5027ea8929a917873bcdaf714138ab5d6d028e3c855b3a61d3 - filename: appsignal-aarch64-linux-musl-all-dynamic.tar.gz - x86_64-freebsd: - static: - checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b - filename: appsignal-x86_64-freebsd-all-static.tar.gz - dynamic: - checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284 - filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz - amd64-freebsd: - static: - checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b - filename: appsignal-x86_64-freebsd-all-static.tar.gz - dynamic: - checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284 - filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz diff --git a/ext/base.rb b/ext/base.rb index 45672bb83..492795250 100644 --- a/ext/base.rb +++ b/ext/base.rb @@ -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 diff --git a/lib/appsignal/extension.rb b/lib/appsignal/extension.rb index 8e437f016..7c9effdcb 100644 --- a/lib/appsignal/extension.rb +++ b/lib/appsignal/extension.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "yaml" - begin if Appsignal::System.jruby? require "appsignal/extension/jruby" @@ -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