From 8f95320f39d7e4e4a29ee70b8718974295a619f4 Mon Sep 17 00:00:00 2001 From: emilylange Date: Tue, 9 Apr 2024 21:52:35 +0200 Subject: [PATCH 1/2] grafana-loki,promtail: 2.9.6 -> 3.0.0 Starting with v3.0.0, the ldflag prefix now also includes `v3`. It's unclear if this will change with each major release. This is something we should keep an eye on. The commit right after this will add a simple version test for this based on `testers.testVersion`. https://github.com/grafana/loki/releases/tag/v3.0.0 changelog: https://github.com/grafana/loki/blob/c9142722684ad6aca2bb09ae5487d5a2af087d0f/CHANGELOG.md diff (unusable, 5000+ edits because upstream vendors go deps): https://github.com/grafana/loki/compare/v2.9.6...v3.0.0 --- pkgs/servers/monitoring/loki/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/monitoring/loki/default.nix b/pkgs/servers/monitoring/loki/default.nix index 2935b9d0bf4c..176ec316a6eb 100644 --- a/pkgs/servers/monitoring/loki/default.nix +++ b/pkgs/servers/monitoring/loki/default.nix @@ -8,14 +8,14 @@ }: buildGoModule rec { - version = "2.9.6"; + version = "3.0.0"; pname = "grafana-loki"; src = fetchFromGitHub { owner = "grafana"; repo = "loki"; rev = "v${version}"; - hash = "sha256-79hK7axHf6soku5DvdXkE/0K4WKc4pnS9VMbVc1FS2I="; + hash = "sha256-2+OST6bKIjuhrXJKA+8vUERKT1/min7tN8oFxKn3L74="; }; vendorHash = null; @@ -40,7 +40,7 @@ buildGoModule rec { passthru.tests = { inherit (nixosTests) loki; }; - ldflags = let t = "github.com/grafana/loki/pkg/util/build"; in [ + ldflags = let t = "github.com/grafana/loki/v3/pkg/util/build"; in [ "-s" "-w" "-X ${t}.Version=${version}" From 271fd55b7ecf4c5a7579a795d3d69519275a6c9f Mon Sep 17 00:00:00 2001 From: emilylange Date: Wed, 10 Apr 2024 16:06:56 +0200 Subject: [PATCH 2/2] grafana-loki: add simple version test v3.0.0 changed the ldflag prefix, which we rely on to pass and embed version information. This is likely to happen again, and such version test is incredibly inexpensive. --- pkgs/servers/monitoring/loki/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/monitoring/loki/default.nix b/pkgs/servers/monitoring/loki/default.nix index 176ec316a6eb..0cf35895ca6c 100644 --- a/pkgs/servers/monitoring/loki/default.nix +++ b/pkgs/servers/monitoring/loki/default.nix @@ -5,6 +5,8 @@ , makeWrapper , nixosTests , systemd +, testers +, grafana-loki }: buildGoModule rec { @@ -38,7 +40,13 @@ buildGoModule rec { --prefix LD_LIBRARY_PATH : "${lib.getLib systemd}/lib" ''; - passthru.tests = { inherit (nixosTests) loki; }; + passthru.tests = { + inherit (nixosTests) loki; + version = testers.testVersion { + command = "loki --version"; + package = grafana-loki; + }; + }; ldflags = let t = "github.com/grafana/loki/v3/pkg/util/build"; in [ "-s"