etcd: refactor, update script, version bump, pkgs-by-name migration (#455578)

This commit is contained in:
Yureka
2025-10-26 09:27:17 +00:00
committed by GitHub
12 changed files with 83 additions and 50 deletions
+1 -2
View File
@@ -516,8 +516,7 @@ in
ergochat = runTest ./ergochat.nix;
esphome = runTest ./esphome.nix;
etc = pkgs.callPackage ../modules/system/etc/test.nix { inherit evalMinimalConfig; };
etcd = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./etcd/etcd.nix;
etcd-cluster = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./etcd/etcd-cluster.nix;
etcd = import ./etcd/default.nix { inherit pkgs runTest; };
etebase-server = runTest ./etebase-server.nix;
etesync-dav = runTest ./etesync-dav.nix;
evcc = runTest ./evcc.nix;
+43
View File
@@ -0,0 +1,43 @@
{
pkgs,
runTest,
...
}:
let
testEtcd =
path: oPkgs:
runTest (
let
etcdPkgs = pkgs // oPkgs;
in
pkgs.lib.recursiveUpdate {
meta = {
maintainers = etcdPkgs.etcd.meta.maintainers;
platforms = [
"aarch64-linux"
"x86_64-linux"
];
};
} (import path etcdPkgs)
);
testEtcdPkg = pkg: path: testEtcd path { etcd = pkg; };
testEtcd_3_4 = testEtcdPkg pkgs.etcd_3_4;
testEtcd_3_5 = testEtcdPkg pkgs.etcd_3_5;
testEtcd_3_6 = testEtcdPkg pkgs.etcd_3_6;
in
{
"3_4" = {
multi-node = testEtcd_3_4 ./multi-node.nix;
single-node = testEtcd_3_4 ./single-node.nix;
};
"3_5" = {
multi-node = testEtcd_3_5 ./multi-node.nix;
single-node = testEtcd_3_5 ./single-node.nix;
};
"3_6" = {
multi-node = testEtcd_3_6 ./multi-node.nix;
single-node = testEtcd_3_6 ./single-node.nix;
};
}
@@ -1,6 +1,5 @@
# This test runs simple etcd cluster
{ pkgs, etcd, ... }:
{ lib, pkgs, ... }:
let
runWithOpenSSL =
file: cmd:
@@ -77,6 +76,7 @@ let
services = {
etcd = {
enable = true;
package = etcd;
keyFile = etcd_key;
certFile = etcd_cert;
trustedCaFile = ca_pem;
@@ -99,10 +99,9 @@ let
networking.firewall.allowedTCPPorts = [ 2380 ];
};
in
{
name = "etcd-cluster";
meta.maintainers = with lib.maintainers; [ offline ];
{
name = "etcd-multi-node";
nodes = {
node1 =
@@ -170,4 +169,5 @@ in
node1.succeed("etcdctl put /foo/bar 'Hello degraded world'")
node1.succeed("etcdctl get /foo/bar | grep 'Hello degraded world'")
'';
}
@@ -1,11 +1,13 @@
# This test runs simple etcd node
{ lib, ... }:
{ etcd, ... }:
{
name = "etcd";
meta.maintainers = with lib.maintainers; [ offline ];
name = "etcd-single-node";
nodes.node = {
services.etcd.enable = true;
services.etcd = {
enable = true;
package = etcd;
};
};
testScript = ''
@@ -19,4 +21,5 @@
node.succeed("etcdctl put /foo/bar 'Hello world'")
node.succeed("etcdctl get /foo/bar | grep 'Hello world'")
'';
}
+3
View File
@@ -0,0 +1,3 @@
{ etcd_3_5 }:
etcd_3_5
+8 -5
View File
@@ -1,22 +1,23 @@
{
lib,
buildGoModule,
buildGo124Module,
fetchFromGitHub,
nixosTests,
}:
buildGoModule rec {
buildGo124Module rec {
pname = "etcd";
version = "3.4.37";
version = "3.4.38";
src = fetchFromGitHub {
owner = "etcd-io";
repo = "etcd";
rev = "v${version}";
hash = "sha256-PZ+8hlxSwayR1yvjHmStMDur9e1uc2s+YB8qdz+42mA=";
hash = "sha256-+fRmz52ZqQTL8JJmSsufoVJP/FGHez9LliEwGsoCE7s=";
};
proxyVendor = true;
vendorHash = "sha256-VeB0A+freNwgETQMIokiOPWovGq1FANUexnzxVg2aRA=";
vendorHash = "sha256-CqeSRyWDw1nCKlAI46iJXT5XjI3elxufx87QIlHwp1w=";
preBuild = ''
go mod tidy
@@ -36,6 +37,8 @@ buildGoModule rec {
install -Dm755 bin/* bin/functional/cmd/* -t $out/bin
'';
passthru.tests = nixosTests.etcd."3_4";
meta = {
description = "Distributed reliable key-value store for the most critical data of a distributed system";
downloadPage = "https://github.com/etcd-io/etcd/";
@@ -101,11 +101,7 @@ symlinkJoin {
deps = {
inherit etcdserver etcdutl etcdctl;
};
tests = {
inherit (nixosTests) etcd etcd-cluster;
k3s = k3s.passthru.tests.etcd;
};
tests = nixosTests.etcd."3_5";
updateScript = ./update.sh;
};
@@ -30,7 +30,7 @@ if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then
ETCD_SRC_HASH=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $ETCD_SRC_HASH)
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "$ETCD_PATH/default.nix"
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "$ETCD_PATH/package.nix"
}
setKV version $LATEST_VERSION
@@ -63,7 +63,7 @@ if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then
# `git` flag here is to be used by local maintainers to speed up the bump process
if [ $# -eq 1 ] && [ "$1" = "git" ]; then
git switch -c "package-$ETCD_PKG_NAME-$LATEST_VERSION"
git add "$ETCD_PATH"/default.nix
git add "$ETCD_PATH"/package.nix
git commit -m "$ETCD_PKG_NAME: $OLD_VERSION -> $LATEST_VERSION
Release: https://github.com/etcd-io/etcd/releases/tag/$LATEST_TAG"
+10 -21
View File
@@ -1,8 +1,7 @@
{
applyPatches,
buildGoModule,
buildGo124Module,
fetchFromGitHub,
fetchpatch,
installShellFiles,
k3s,
lib,
@@ -12,11 +11,11 @@
}:
let
version = "3.6.4";
etcdSrcHash = "sha256-otz+06cOD2MVnMZWKId1GN+MeZfnDbdudiYfVCKdzuo=";
etcdCtlVendorHash = "sha256-kTH+s/SY+xwo6kt6iPJ7XDhin0jPk0FBr0eOe/717bE=";
etcdUtlVendorHash = "sha256-P0yx9YMMD9vT7N6LOlo26EAOi+Dj33p3ZjAYEoaL19A=";
etcdServerVendorHash = "sha256-kgbCT1JxI98W89veCItB7ZfW4d9D3/Ip3tOuFKEX9v4=";
version = "3.6.5";
etcdSrcHash = "sha256-d0Ujg9ynnnSW0PYYYrNEmPtLnYW2HcCl+zcVo8ACiS0=";
etcdCtlVendorHash = "sha256-5r3Q+AfWp23tzbYQoD1hXEzRttJrUUKQSpcEV3GIlOE=";
etcdUtlVendorHash = "sha256-funO7EEJs28w4sk4sHVA/KR1TiHumVKNs0Gn/xFl4ig=";
etcdServerVendorHash = "sha256-OtWpX5A+kyQej2bueTqmNf62oKmXGQzjexzXlK/XJms=";
src = applyPatches {
src = fetchFromGitHub {
@@ -25,12 +24,6 @@ let
tag = "v${version}";
hash = etcdSrcHash;
};
patches = [
(fetchpatch {
url = "https://github.com/etcd-io/etcd/commit/31650ab0c8df43af05fc4c13b48ffee59271eec7.patch";
hash = "sha256-Q94HOLFx2fnb61wMQsAUT4sIBXfxXqW9YEayukQXX18=";
})
];
};
env = {
@@ -46,7 +39,7 @@ let
platforms = lib.platforms.darwin ++ lib.platforms.linux;
};
etcdserver = buildGoModule {
etcdserver = buildGo124Module {
pname = "etcdserver";
inherit
@@ -73,7 +66,7 @@ let
ldflags = [ "-X go.etcd.io/etcd/api/v3/version.GitSHA=GitNotFound" ];
};
etcdutl = buildGoModule {
etcdutl = buildGo124Module {
pname = "etcdutl";
inherit
@@ -99,7 +92,7 @@ let
'';
};
etcdctl = buildGoModule {
etcdctl = buildGo124Module {
pname = "etcdctl";
inherit
@@ -132,11 +125,7 @@ symlinkJoin {
deps = {
inherit etcdserver etcdutl etcdctl;
};
# Fix-Me: Tests for etcd 3.6 needs work.
# tests = {
# inherit (nixosTests) etcd etcd-cluster;
# k3s = k3s.passthru.tests.etcd;
# };
tests = nixosTests.etcd."3_6";
updateScript = ./update.sh;
};
+2 -2
View File
@@ -30,7 +30,7 @@ if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then
ETCD_SRC_HASH=$(nix hash to-sri --type sha256 $ETCD_SRC_HASH)
setKV () {
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "$ETCD_PATH/default.nix"
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "$ETCD_PATH/package.nix"
}
setKV version $LATEST_VERSION
@@ -63,7 +63,7 @@ if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then
# `git` flag here is to be used by local maintainers to speed up the bump process
if [ $# -eq 1 ] && [ "$1" = "git" ]; then
git switch -c "package-$ETCD_PKG_NAME-$LATEST_VERSION"
git add "$ETCD_PATH"/default.nix
git add "$ETCD_PATH"/package.nix
git commit -m "$ETCD_PKG_NAME: $OLD_VERSION -> $LATEST_VERSION
Release: https://github.com/etcd-io/etcd/releases/tag/$LATEST_TAG"
-3
View File
@@ -9241,9 +9241,6 @@ with pkgs;
dodgy = with python3Packages; toPythonApplication dodgy;
etcd = etcd_3_5;
etcd_3_5 = callPackage ../servers/etcd/3_5 { };
prosody = callPackage ../servers/xmpp/prosody {
withExtraLibs = [ ];
withExtraLuaPackages = _: [ ];