packages/grafana: 10.3.1 -> 10.4.2

This commit is contained in:
Max Headroom 2024-05-03 22:27:18 +02:00
parent c537e38d33
commit 3d12645d38

View file

@ -2,7 +2,7 @@
, tzdata, wire
, yarn, nodejs, python3, cacert
, jq, moreutils
, nix-update-script, nixosTests
, nix-update-script, nixosTests, xcbuild
}:
let
@ -18,38 +18,35 @@ let
done
rm -r packages/grafana-e2e
'';
# Injects a `t.Skip()` into a given test since
# there's apparently no other way to skip tests here.
skipTest = lineOffset: testCase: file:
let
jumpAndAppend = lib.concatStringsSep ";" (lib.replicate (lineOffset - 1) "n" ++ [ "a" ]);
in ''
sed -i -e '/${testCase}/{
${jumpAndAppend} t.Skip();
}' ${file}
'';
in
buildGoModule rec {
pname = "grafana";
version = "10.3.1";
version = "10.4.2";
excludedPackages = [ "alert_webhook_listener" "clean-swagger" "release_publisher" "slow_proxy" "slow_proxy_mac" "macaron" "devenv" "modowners" ];
subPackages = [ "pkg/cmd/grafana" "pkg/cmd/grafana-server" "pkg/cmd/grafana-cli" ];
src = fetchFromGitHub {
owner = "grafana";
repo = "grafana";
rev = "v${version}";
hash = "sha256-UPIq7BWTlT0omt/SM5+vkfOHvsdcx/ikkjcW9X8pcw0=";
hash = "sha256-ahG9ABJJUUgrFqqNjkJRA1Gia8T4J90jIsCMFOhZ55w=";
};
# borrowed from: https://github.com/NixOS/nixpkgs/blob/d70d9425f49f9aba3c49e2c389fe6d42bac8c5b0/pkgs/development/tools/analysis/snyk/default.nix#L20-L22
env = lib.optionalAttrs (stdenv.isDarwin && stdenv.isx86_64) {
# Fix error: no member named 'aligned_alloc' in the global namespace.
# Occurs while building @esfx/equatable@npm:1.0.2 on x86_64-darwin
NIX_CFLAGS_COMPILE = "-D_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION=1";
};
offlineCache = stdenv.mkDerivation {
name = "${pname}-${version}-yarn-offline-cache";
inherit src;
inherit src env;
nativeBuildInputs = [
yarn nodejs cacert
jq moreutils
];
jq moreutils python3
# @esfx/equatable@npm:1.0.2 fails to build on darwin as it requires `xcbuild`
] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcbuild ];
postPatch = ''
${patchAwayGrafanaE2E}
'';
@ -58,7 +55,7 @@ buildGoModule rec {
export HOME="$(mktemp -d)"
yarn config set enableTelemetry 0
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures.os '[ "linux" ]'
yarn config set --json supportedArchitectures.os '[ "linux", "darwin" ]'
yarn config set --json supportedArchitectures.cpu '["arm", "arm64", "ia32", "x64"]'
yarn
runHook postBuild
@ -67,14 +64,21 @@ buildGoModule rec {
dontInstall = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = "sha256-70eMa8E483f/Bz7iy+4Seap1EfIdjD5krnt6W9CUows=";
outputHash = rec {
x86_64-linux = "sha256-3CZgs732c6Z64t2sfWjPAmMFKVTzoolv2TwrbjeRCBA=";
aarch64-linux = x86_64-linux;
aarch64-darwin = "sha256-NKEajOe9uDZw0MF5leiKBIRH1CHUELRho7gyCa96BO8=";
x86_64-darwin = aarch64-darwin;
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
disallowedRequisites = [ offlineCache ];
vendorHash = "sha256-Gf2A22d7/8xU/ld7kveqGonVKGFCArGNansPRGhfyXM=";
vendorHash = "sha256-XmIF/ZWVO1qjSmRPTFnHgxvnliXXicGgsV8gQcKJl9U=";
nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo python3 ];
proxyVendor = true;
nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo python3 ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcbuild ];
postPatch = ''
${patchAwayGrafanaE2E}
@ -89,36 +93,6 @@ buildGoModule rec {
GOARCH= CGO_ENABLED=0 go generate ./pkg/plugins/plugindef
GOARCH= CGO_ENABLED=0 go generate ./kinds/gen.go
GOARCH= CGO_ENABLED=0 go generate ./public/app/plugins/gen.go
GOARCH= CGO_ENABLED=0 go generate ./pkg/kindsys/report.go
# Work around `main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/pkg/util/xorm`.
# Apparently these files confuse the dependency resolution for the go builder implemented here.
rm pkg/util/xorm/go.{mod,sum}
# The testcase makes an API call against grafana.com:
#
# [...]
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get latest.json repo from github.com" logger=update.checker error="Get \"https://raw.githubusercontent.com/grafana/grafana/main/latest.json\": dial tcp: lookup raw.githubusercontent.com on [::1]:53: read udp [::1]:36391->[::1]:53: read: connection refused"
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get plugins repo from grafana.com" logger=plugin.manager error="Get \"https://grafana.com/api/plugins/versioncheck?slugIn=&grafanaVersion=\": dial tcp: lookup grafana.com on [::1]:53: read udp [::1]:41796->[::1]:53: read: connection refused"
${skipTest 1 "Request is not forbidden if from an admin" "pkg/tests/api/plugins/api_plugins_test.go"}
# Skip a flaky test (https://github.com/NixOS/nixpkgs/pull/126928#issuecomment-861424128)
${skipTest 2 "it should change folder successfully and return correct result" "pkg/services/libraryelements/libraryelements_patch_test.go"}
# Skip flaky tests (https://logs.ofborg.org/?key=nixos/nixpkgs.263185&attempt_id=5b056a17-67a7-4b74-9dc7-888eb1d6c2dd)
${skipTest 1 "TestIntegrationRulerAccess" "pkg/tests/api/alerting/api_alertmanager_test.go"}
${skipTest 1 "TestIntegrationRulePause" "pkg/tests/api/alerting/api_ruler_test.go"}
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
rm -r scripts/go
# Requires making API calls against storage.googleapis.com:
#
# [...]
# grafana> 2023/08/24 08:30:23 failed to copy objects, err: Post "https://storage.googleapis.com/upload/storage/v1/b/grafana-testing-repo/o?alt=json&name=test-path%2Fbuild%2FTestCopyLocalDir2194093976%2F001%2Ffile2.txt&prettyPrint=false&projection=full&uploadType=multipart": dial tcp: lookup storage.googleapis.com on [::1]:53: read udp [::1]:36436->[::1]:53: read: connection refused
# grafana> panic: test timed out after 10m0s
rm pkg/build/gcloud/storage/gsutil_test.go
# Setup node_modules
export HOME="$(mktemp -d)"
@ -175,10 +149,10 @@ buildGoModule rec {
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.agpl3;
license = licenses.agpl3Only;
homepage = "https://grafana.com";
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
platforms = platforms.linux ++ platforms.darwin;
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
mainProgram = "grafana-server";
};
}