From 8a19c36a0e54acd6c887883920cca394ede616cd Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Tue, 22 Oct 2024 17:27:29 +0200 Subject: [PATCH 1/3] Implement requirement.json --- .gitlab-ci.yml | 7 +++++++ .gitlab/prepare-oci-package.sh | 1 + lib-injection/requirements.json | 19 +++++++++++++++++++ lib-injection/test_allow.json | 4 ++++ lib-injection/test_block.json | 4 ++++ 5 files changed, 35 insertions(+) create mode 100644 lib-injection/requirements.json create mode 100644 lib-injection/test_allow.json create mode 100644 lib-injection/test_block.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2948a30f937..01e13b54dec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -115,6 +115,13 @@ package-oci: - build-gem - install-dependencies +requirements_json_test: + rules: + - when: on_success + variables: + REQUIREMENTS_BLOCK_JSON_PATH: "lib-injection/test_block.json" + REQUIREMENTS_ALLOW_JSON_PATH: "lib-injection/test_allow.json" + onboarding_tests_installer: parallel: matrix: diff --git a/.gitlab/prepare-oci-package.sh b/.gitlab/prepare-oci-package.sh index cf96732ba47..d051f359c15 100755 --- a/.gitlab/prepare-oci-package.sh +++ b/.gitlab/prepare-oci-package.sh @@ -5,6 +5,7 @@ set -e mkdir sources cp ../lib-injection/host_inject.rb sources +cp ../lib-injection/requirements.json sources/requirements.json # Kubernetes injection expects a different path ln -rs sources/host_inject.rb sources/auto_inject.rb diff --git a/lib-injection/requirements.json b/lib-injection/requirements.json new file mode 100644 index 00000000000..43c798d7ac6 --- /dev/null +++ b/lib-injection/requirements.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/DataDog/auto_inject/refs/heads/main/preload_go/cmd/library_requirements_tester/testdata/requirements_schema.json", + "version": 1, + "native_deps": { + "glibc": [ + { + "arch": "x86", + "supported": true, + "min": "2.28" + }, + { + "arch": "arm64", + "supported": true, + "min": "2.28" + } + ] + }, + "deny": [] +} diff --git a/lib-injection/test_allow.json b/lib-injection/test_allow.json new file mode 100644 index 00000000000..ccfdd703f79 --- /dev/null +++ b/lib-injection/test_allow.json @@ -0,0 +1,4 @@ +[ + {"name": "✅ 2.28 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.28"}}, + {"name": "✅ 2.28 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.28"}}, +] diff --git a/lib-injection/test_block.json b/lib-injection/test_block.json new file mode 100644 index 00000000000..958fdca1b80 --- /dev/null +++ b/lib-injection/test_block.json @@ -0,0 +1,4 @@ +[ + {"name": "❌ 2.27 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.27"}}, + {"name": "❌ 2.27 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.27"}}, +] From 52ebf4f0363e5b2b31a3e5feae2237c5b1095e37 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 30 Oct 2024 17:55:42 +0100 Subject: [PATCH 2/3] Reduce requirement to 2.27 --- lib-injection/requirements.json | 4 ++-- lib-injection/test_allow.json | 4 ++-- lib-injection/test_block.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib-injection/requirements.json b/lib-injection/requirements.json index 43c798d7ac6..445d56d57ae 100644 --- a/lib-injection/requirements.json +++ b/lib-injection/requirements.json @@ -6,12 +6,12 @@ { "arch": "x86", "supported": true, - "min": "2.28" + "min": "2.27" }, { "arch": "arm64", "supported": true, - "min": "2.28" + "min": "2.27" } ] }, diff --git a/lib-injection/test_allow.json b/lib-injection/test_allow.json index ccfdd703f79..5fb82d14e85 100644 --- a/lib-injection/test_allow.json +++ b/lib-injection/test_allow.json @@ -1,4 +1,4 @@ [ - {"name": "✅ 2.28 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.28"}}, - {"name": "✅ 2.28 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.28"}}, + {"name": "✅ 2.27 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.27"}}, + {"name": "✅ 2.27 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.27"}} ] diff --git a/lib-injection/test_block.json b/lib-injection/test_block.json index 958fdca1b80..250362a1238 100644 --- a/lib-injection/test_block.json +++ b/lib-injection/test_block.json @@ -1,4 +1,4 @@ [ - {"name": "❌ 2.27 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.27"}}, - {"name": "❌ 2.27 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.27"}}, + {"name": "❌ 2.26 glibc x86" ,"filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "x86" , "libc": "glibc:2.26"}}, + {"name": "❌ 2.26 glibc arm64","filepath": "/some/path", "args": [], "envars": [], "host": {"os": "linux", "arch": "arm64", "libc": "glibc:2.26"}} ] From 357ec4c6e744cb29996320de5983cf59ff48e668 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 30 Oct 2024 18:19:13 +0100 Subject: [PATCH 3/3] Add musl keys --- lib-injection/requirements.json | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib-injection/requirements.json b/lib-injection/requirements.json index 445d56d57ae..39afa46b724 100644 --- a/lib-injection/requirements.json +++ b/lib-injection/requirements.json @@ -6,12 +6,26 @@ { "arch": "x86", "supported": true, - "min": "2.27" + "min": "2.27", + "description": "libffi needs memfd_create" }, { "arch": "arm64", "supported": true, - "min": "2.27" + "min": "2.27", + "description": "libffi needs memfd_create" + } + ], + "musl": [ + { + "arch": "x86", + "supported": false, + "description": "no musl build" + }, + { + "arch": "arm64", + "supported": false, + "description": "no musl build" } ] },