Compare commits

..

1 commit

Author SHA1 Message Date
raito 7cf75daed7 wip! wip! latest version of buildbot
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-07-22 15:18:09 +02:00
8 changed files with 28 additions and 155 deletions

View file

@ -64,11 +64,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1721685540,
"narHash": "sha256-sIFaurUhoxZBahwfXpHRfMk41FexvULOe03qRBe7uiA=",
"lastModified": 1721651783,
"narHash": "sha256-Uuqe5lk8HLUbbEgbve2J7soFEcxm0VbaP82p3+MtrtE=",
"ref": "refs/heads/non-flakes",
"rev": "3c903f14c25d87f4fb0b3a0ee7e860b6fa5b2d96",
"revCount": 290,
"rev": "7e9efd267d13ae25ef920770d128e9f8205eb1ba",
"revCount": 283,
"type": "git",
"url": "https://git.lix.systems/lix-project/buildbot-nix.git"
},
@ -258,11 +258,11 @@
]
},
"locked": {
"lastModified": 1721682989,
"narHash": "sha256-kjJiZ7m4HKqbZ2mxNQiB32/goKFb8BRi8OqC4wIU0OI=",
"lastModified": 1721210741,
"narHash": "sha256-jAFXbe8CA6S25NmAwncidyPgBvLK7a8dcj8AdRGaxUY=",
"ref": "refs/heads/main",
"rev": "4b107e6ff36bd89958fba36e0fe0340903e7cd13",
"revCount": 4190,
"rev": "b0e9b4b2f99f9d8f5c4e780e89f955c394b5ced4",
"revCount": 4181,
"type": "git",
"url": "https://git.lix.systems/lix-project/hydra.git"
},

View file

@ -40,8 +40,8 @@
hydra.enable = true;
hydra.dbi = "dbi:Pg:dbname=hydra;user=hydra";
# Takes 10 builders (0 → 9).
hydra.builders = lib.genList (i: "builder-${builtins.toString i}") 10;
# Takes 4 builders (0 → 3).
hydra.builders = lib.genList (i: "builder-${builtins.toString i}") 4;
ofborg.enable = true;
};

View file

@ -51,7 +51,7 @@
name = "nixpkgs-${branchName}";
fromUri = "https://github.com/NixOS/nixpkgs";
fromRefspec = branchName;
localRefspec = branchName;
localRefspec = "refs/remotes/origin/${branchName}";
inherit timer;
};
in
@ -66,37 +66,22 @@
branchName = "master";
};
branches."refs/heads/staging" = mkNixpkgsJob {
timer = "hourly";
branchName = "staging";
};
branches."refs/heads/release-24.05" = mkNixpkgsJob {
timer = "hourly";
branchName = "release-24.05";
};
branches."refs/heads/staging-24.05" = mkNixpkgsJob {
timer = "hourly";
branchName = "staging-24.05";
};
branches."refs/heads/release-23.11" = mkNixpkgsJob {
timer = "hourly";
branchName = "release-23.11";
};
branches."refs/heads/staging-23.11" = mkNixpkgsJob {
timer = "hourly";
branchName = "staging-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 = "sandbox/raito/raito-unstable-small";
localRefspec = "refs/remotes/origin/sandbox/raito/raito-unstable-small";
timer = "*-*-* 12:00:00";
};
@ -104,7 +89,7 @@
name = "raito-release-sync";
fromUri = "https://github.com/NixOS/nixpkgs";
fromRefspec = "nixos-24.05";
localRefspec = "sandbox/raito/raito-nixos-24.05";
localRefspec = "refs/remotes/origin/sandbox/raito/raito-nixos-24.05";
timer = "daily";
};
};

View file

@ -57,16 +57,6 @@ in
fsType = "xfs";
};
fileSystems."/mnt" = {
device = "/dev/disk/by-label/hydra";
fsType = "xfs";
};
# We want the tmp filesystem on the same filesystem as the hydra store, so that builds can use reflinks
fileSystems."/tmp" = {
device = "/mnt/tmp";
options = [ "bind" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
@ -145,14 +135,6 @@ in
MaxStartups = "500:30:1000";
};
systemd.services.hydra-gc = {
description = "Nix Garbage Collector";
script = "exec ${config.nix.package.out}/bin/nix-store --gc --store /mnt";
serviceConfig.Type = "oneshot";
serviceConfig.User = "builder";
startAt = "*-*-* 00/8:00:00";
};
systemd.timers.hydra-gc.timerConfig.Persistent = true;
bagel.sysadmin.enable = true;

View file

@ -32,11 +32,7 @@ in
age.secrets.buildbot-workers.file = ../../secrets/buildbot-workers.age;
age.secrets.buildbot-service-key.file = ../../secrets/buildbot-service-key.age;
age.secrets.buildbot-signing-key.file = ../../secrets/buildbot-signing-key.age;
age.secrets.buildbot-remote-builder-key = {
file = ../../secrets/buildbot-remote-builder-key.age;
owner = "buildbot-worker";
group = "buildbot-worker";
};
age.secrets.buildbot-remote-builder-key.file = ../../secrets/buildbot-remote-builder-key.age;
services.nginx.virtualHosts.${cfg.domain} = {
forceSSL = true;
@ -62,7 +58,7 @@ in
(_: lib.foldl' lib.add 0)
(lib.concatMap
(m: map (s: { ${s} = m.maxJobs; }) m.systems)
config.services.buildbot-nix.coordinator.buildMachines))
config.nix.buildMachines))
);
};

View file

@ -13,11 +13,10 @@ let
};
};
mkSyncService = targetRef: { name, fromUri, fromRefspec, localRefspec, ... }: {
path = [ pkgs.gitFull pkgs.openssh pkgs.lix ];
path = [ pkgs.gitFull pkgs.openssh ];
script = ''
set -xe
RUNTIME_DIRECTORY="/run/onewaysync-${name}"
trap "git worktree remove -f "$RUNTIME_DIRECTORY"/${name}" EXIT
set -x
trap "git worktree prune && git worktree remove -f ${name}" EXIT
if [ ! -d "/var/lib/onewaysync/nixpkgs" ]; then
echo "First run, synchronizing nixpkgs..."
@ -27,30 +26,20 @@ let
cd /var/lib/onewaysync/nixpkgs
echo "Syncing ${fromUri}:${fromRefspec} to /var/lib/onewaysync/nixpkgs:${targetRef}"
echo "Current ref: $EXPECTED_REF"
git worktree add -f "$RUNTIME_DIRECTORY"/${name} refs/remotes/origin/${localRefspec}
cd "$RUNTIME_DIRECTORY"/${name}
git pull origin ${localRefspec}
EXPECTED_REF=$(git rev-list refs/remotes/origin/${localRefspec} | head -1)
git config user.name Fork-o-Tron
git config user.email noreply@forkos.org
git worktree add -f ${cfg.workingDir}/${name} ${localRefspec}
cd ${cfg.workingDir}/${name}
git pull origin ${fromRefspec}
EXPECTED_REF=$(git rev-list ${localRefspec} | head -1)
git fetch ${fromUri} ${fromRefspec}
'' + lib.optionalString (!(lib.hasInfix "staging" localRefspec)) ''
OLD_STDENV=$(nix eval -f . stdenv.outPath --store "$RUNTIME_DIRECTORY")
'' + ''
git merge FETCH_HEAD
'' + lib.optionalString (!(lib.hasInfix "staging" localRefspec)) ''
NEW_STDENV=$(nix eval -f . stdenv.outPath --store "$RUNTIME_DIRECTORY")
# Do not allow auto-merging a staging iteration
test "$OLD_STDENV" = "$NEW_STDENV"
'' + ''
GIT_SSH_COMMAND='ssh -i ${cfg.deployKeyPath}' git push ${cfg.pushUrl} HEAD:${targetRef}
git rebase FETCH_HEAD
GIT_SSH_COMMAND='ssh -i ${cfg.deployKeyPath}' git push ${cfg.pushUrl} HEAD:${targetRef} --force-with-lease=${targetRef}:$EXPECTED_REF --force-if-includes
'';
serviceConfig = {
User = "git";
Group = "git";
Type = "oneshot";
RuntimeDirectory = "onewaysync-${name}";
WorkingDirectory = "/run/onewaysync-${name}";
RuntimeDirectory = "onewaysync";
WorkingDirectory = cfg.workingDir;
StateDirectory = "onewaysync";
};
};

View file

@ -14,7 +14,7 @@ let
# XXX: to support Nix's dumb public host key syntax (base64'd), this outputs
# a string with shell-style command interpolations: $(...).
mkBaremetalBuilder = { parallelBuilds, publicHostKey, host, speedFactor ? 1, user ? "builder", supportedSystems ? [ "i686-linux" "x86_64-linux" ], supportedFeatures ? [ "big-parallel" "kvm" "nixos-test" ] }:
"ssh://${user}@${host}?remote-store=/mnt ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString parallelBuilds} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - $(echo -n '${publicHostKey}' | base64 -w0)";
"ssh://${user}@${host} ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString parallelBuilds} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - $(echo -n '${publicHostKey}' | base64 -w0)";
# TODO:
# - generalize to new architectures
@ -117,7 +117,7 @@ in {
upload_logs_to_binary_cache = true
evaluator_workers = 16
evaluator_workers = 4
evaluator_max_memory_size = 4096
max_concurrent_evals = 1

View file

@ -32,45 +32,6 @@ in
visible = true;
};
resource.hydra_jobset.k900-experiments = {
project = config.resource.hydra_project.forkos.name;
state = "enabled";
visible = true;
name = "nixpkgs-experiments";
type = "legacy";
description = "experiments branch to test things for K900";
nix_expression = {
file = "nixos/release.nix";
input = "nixpkgs";
};
check_interval = 0;
scheduling_shares = 3000;
keep_evaluations = 3;
email_notifications = false;
input = [
{
name = "nixpkgs";
type = "git";
value = "https://github.com/nixos/nixpkgs 03ff49192b044786362c8c94d8501eac5c6eada4";
notify_committers = false;
}
{
name = "officialRelease";
type = "boolean";
value = false;
}
{
name = "supportedSystems";
type = "nix";
value = ''[ "x86_64-linux" ]'';
}
];
};
resource.hydra_jobset.raito-nixos-rolling-small = {
project = config.resource.hydra_project.forkos.name;
state = "enabled";
@ -204,45 +165,5 @@ in
email_notifications = false;
};
resource.hydra_jobset.yureka-staging-test = {
project = config.resource.hydra_project.forkos.name;
state = "enabled";
visible = true;
name = "yureka-staging-test";
type = "legacy";
description = "staging branch for yureka-nixos";
nix_expression = {
file = "pkgs/top-level/release.nix";
input = "nixpkgs";
};
check_interval = 0;
scheduling_shares = 3000;
keep_evaluations = 3;
email_notifications = false;
input = [
{
name = "nixpkgs";
type = "git";
value = "https://cl.forkos.org/nixpkgs sandbox/yureka/staging-test";
notify_committers = false;
}
{
name = "officialRelease";
type = "boolean";
value = "false";
notify_committers = false;
}
{
name = "supportedSystems";
type = "nix";
value = ''[ "x86_64-linux" ]'';
}
];
};
};
}