From 80c475757185535f20fead3b00dd2c772caeddf8 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Thu, 4 Jul 2024 15:18:21 +0200 Subject: [PATCH] gerrit01: add a one-way-sync service It's basic and does not handle conflicts which needs to be manually managed. Signed-off-by: Raito Bezarius --- hosts/gerrit01/default.nix | 55 ++++++++++++++ secrets.nix | 2 + secrets/ows-deploy-key.age | Bin 0 -> 733 bytes services/gerrit/default.nix | 1 + services/gerrit/one-way-sync.nix | 121 +++++++++++++++++++++++++++++++ 5 files changed, 179 insertions(+) create mode 100644 secrets/ows-deploy-key.age create mode 100644 services/gerrit/one-way-sync.nix diff --git a/hosts/gerrit01/default.nix b/hosts/gerrit01/default.nix index 49e93ae..de3a056 100755 --- a/hosts/gerrit01/default.nix +++ b/hosts/gerrit01/default.nix @@ -39,6 +39,61 @@ data = "/gerrit-data"; }; + age.secrets.ows-deploy-key = { + file = ../../secrets/ows-deploy-key.age; + mode = "0600"; + owner = "git"; + group = "git"; + }; + bagel.nixpkgs.one-way-sync = + let + mkNixpkgsJob = { timer, branchName }: { + name = "nixpkgs-${branchName}"; + fromUri = "https://github.com/NixOS/nixpkgs"; + fromRefspec = branchName; + localRefspec = "refs/remotes/origin/${branchName}"; + inherit timer; + }; + in + { + enable = true; + + pushUrl = "ssh://ows_bot@cl.forkos.org:29418/nixpkgs"; + deployKeyPath = config.age.secrets.ows-deploy-key.path; + + branches."refs/heads/master" = mkNixpkgsJob { + timer = "hourly"; + branchName = "master"; + }; + + branches."refs/heads/release-24.05" = mkNixpkgsJob { + timer = "hourly"; + branchName = "release-24.05"; + }; + + branches."refs/heads/release-23.11" = mkNixpkgsJob { + timer = "hourly"; + branchName = "release-23.11"; + }; + + # Testing jobs for personal sandbox branches + branches."refs/heads/sandbox/raito/raito-unstable-small" = { + name = "raito-unstable-sync"; + fromUri = "https://github.com/NixOS/nixpkgs"; + fromRefspec = "nixos-unstable-small"; + localRefspec = "refs/remotes/origin/sandbox/raito/raito-unstable-small"; + timer = "*-*-* 12:00:00"; + }; + + branches."refs/heads/sandbox/raito/raito-nixos-24.05" = { + name = "raito-release-sync"; + fromUri = "https://github.com/NixOS/nixpkgs"; + fromRefspec = "nixos-24.05"; + localRefspec = "refs/remotes/origin/sandbox/raito/raito-nixos-24.05"; + timer = "daily"; + }; + }; + i18n.defaultLocale = "fr_FR.UTF-8"; system.stateVersion = "24.05"; diff --git a/secrets.nix b/secrets.nix index badeab9..8e83190 100644 --- a/secrets.nix +++ b/secrets.nix @@ -26,6 +26,8 @@ let # These are the same password, but nginx wants it in htpasswd format metrics-push-htpasswd = [ machines.meta01 ]; metrics-push-password = builtins.attrValues machines; + + ows-deploy-key = [ machines.gerrit01 ]; }; in builtins.listToAttrs ( diff --git a/secrets/ows-deploy-key.age b/secrets/ows-deploy-key.age new file mode 100644 index 0000000000000000000000000000000000000000..d2791d7654d18661f944abe755f8442e79124128 GIT binary patch literal 733 zcmV<30wVokXJsvAZewzJaCB*JZZ2^6&a7%1(NkUV2a6wO3SamdbLvv_PGBZR`3RX5! zVQETQL3m|wdO>4Jb8>cBQdV|3D@`j}Gi7N(I4fB-S7}T$Xk|-h3N0-yAZ&I)Z+SOW zb~Hb6j4dGp#_0(f#X;AcHFX$Rv&47X*V z9cise6t`}JWo9x>%dJ-8`{B6;ty)Ql=>1@Ww7tYxTfN7E{`fN<*m*)ezBI< z#d_ym$*ASIjk0-)Uoe7?B3~U^Wf7w9qMb(;rkS7;@J`wrTqE+M!pU)cH5>g(ir4@+ z>zo`mEJ_m?5{&kTH38!3ewK^@`kfO(2Kp%ot5^rkzqQCwPZQh*k&!uyetUWX?rLV* z<*36=S?10ys93>LplE9RGuyY7{X8F{_s#lD$9_nX0tA?F_`~DnEwnDuJ*o5XRtGf% zF>2l%i`NfB=$Ps`!*%`?S!T3E;0~<}?fUu5b!0