datadog-agent: 6.11.2 -> 7.30.2

datadog-agent is now built as a go module.  However, the build process
is now to be driven by the python invoke tool.  While datadog-agent
builds with buildGoModule, some investigation should be done to ensure
we are not missing any integrations or features from the invoke build
system.

This also updates datadog-agent from python 2.7 to 3.x.

One other issue of note: most of the invoke tasks seem to use some git
parsing to get version numbers and the like. This package may need to
be checked for reproducibility issues now.
This commit is contained in:
John Soo 2021-08-28 19:37:58 -07:00
parent d559051a1c
commit f2d81d2484
5 changed files with 23 additions and 1377 deletions

View file

@ -1,11 +1,6 @@
To update datadog-agent v6 (v5 is deprecated and should be removed):
To update datadog-agent v7 (v5 is deprecated and should be removed):
1. Bump `version`, `rev`, `sha256` and `payloadVersion` in `datadog-agent.nix`
2. `git clone https://github.com/DataDog/datadog-agent.git && cd datadog-agent`
3. `git checkout <tag>`
4. `nix-env -i -f https://github.com/nixcloud/dep2nix/archive/master.tar.gz`
5. `dep2nix`
6. `cp deps.nix $NIXPKGS/pkgs/tools/networking/dd-agent/datadog-agent-deps.nix`
1. Bump `version`, `rev`, `sha256`, `vendorSha256` and `payloadVersion` in `datadog-agent.nix`
To update datadog-process-agent:

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,26 @@
{ lib, fetchFromGitHub, buildGoPackage, makeWrapper, pythonPackages, pkg-config, systemd, hostname, extraTags ? [] }:
{ lib, buildGoModule, makeWrapper, fetchgit, git, invoke, pyaml, pythonPackages, pkg-config, systemd, hostname, extraTags ? [] }:
let
# keep this in sync with github.com/DataDog/agent-payload dependency
payloadVersion = "4.7.1";
payloadVersion = "4.78.0";
python = pythonPackages.python;
in buildGoPackage rec {
pname = "datadog-agent";
version = "6.11.2";
owner = "DataDog";
repo = "datadog-agent";
goPackagePath = "github.com/${owner}/${repo}";
src = fetchFromGitHub {
inherit owner repo;
rev = version;
sha256 = "1dwdiaf357l9c6b2cps5mdyfma3c1mp96zzxg1826fvz3x8ix68z";
in buildGoModule rec {
pname = "datadog-agent";
version = "7.30.2";
src = fetchgit {
url = "https://${goPackagePath}.git";
rev = version;
leaveDotGit = true;
sha256 = "1cpybjwnby265w307p3hdg06448xrmapjbvd6zp46d7rsi4lj6vn";
};
vendorSha256 = "06ryy501vibc6n14qwg94394c76l060525y6qg261qb748mbi8qi";
subPackages = [
"cmd/agent"
"cmd/cluster-agent"
@ -24,15 +28,12 @@ in buildGoPackage rec {
"cmd/py-launcher"
"cmd/trace-agent"
];
goDeps = ./datadog-agent-deps.nix;
goPackagePath = "github.com/${owner}/${repo}";
nativeBuildInputs = [ pkg-config makeWrapper ];
nativeBuildInputs = [ git pyaml invoke pkg-config makeWrapper ];
buildInputs = [ systemd ];
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
preBuild = let
ldFlags = lib.concatStringsSep " " [
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
@ -43,6 +44,7 @@ in buildGoPackage rec {
];
in ''
buildFlagsArray=( "-tags" "ec2 systemd cpython process log secrets ${lib.concatStringsSep " " extraTags}" "-ldflags" "${ldFlags}")
invoke generate --mod=vendor
'';
# DataDog use paths relative to the agent binary, so fix these.
@ -61,7 +63,7 @@ in buildGoPackage rec {
cp -R $src/cmd/agent/dist/conf.d $out/share/datadog-agent
cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages}
cp -R $src/pkg/status/dist/templates $out/share/datadog-agent
cp -R $src/pkg/status/templates $out/share/datadog-agent
wrapProgram "$out/bin/agent" \
--set PYTHONPATH "$out/${python.sitePackages}" \

View file

@ -65,7 +65,7 @@ let
pname = "checks-base";
sourceRoot = "datadog_checks_base";
propagatedBuildInputs = with python.pkgs; [
requests protobuf prometheus-client uuid simplejson uptime
requests protobuf prometheus-client simplejson uptime
];
};

View file

@ -23983,10 +23983,12 @@ with pkgs;
dd-agent = callPackage ../tools/networking/dd-agent/5.nix { };
datadog-agent = callPackage ../tools/networking/dd-agent/datadog-agent.nix {
pythonPackages = datadog-integrations-core {};
invoke = python3Packages.invoke;
pyaml = python3Packages.pyaml;
};
datadog-process-agent = callPackage ../tools/networking/dd-agent/datadog-process-agent.nix { };
datadog-integrations-core = extras: callPackage ../tools/networking/dd-agent/integrations-core.nix {
python = python27;
python = python3;
extraIntegrations = extras;
};