re-enable hydra

This commit is contained in:
2025-03-26 02:43:56 -04:00
parent de8ec7cfe6
commit 3e7cd3b59d
8 changed files with 109 additions and 83 deletions

View File

@ -1,4 +1,4 @@
{ pulls, branches, ... }:
{ pulls, ... }:
let
# create the json spec for the jobset
makeSpec =
@ -18,8 +18,7 @@ let
};
prs = readJSONFile pulls;
refs = readJSONFile branches;
repo = "RAD-Development/nix-dotfiles";
# refs = readJSONFile branches;
# template for creating a job
makeJob =
@ -44,27 +43,27 @@ let
emailoverride = "";
};
# Create a hydra job for a branch
jobOfRef =
name:
{ ref, ... }:
if ((builtins.match "^refs/heads/(.*)$" ref) == null) then
null
else
{
name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}";
value = makeJob {
description = "Branch ${name}";
flake = "git+ssh://git@github.com/${repo}?ref=${ref}";
};
};
# # Create a hydra job for a branch
# jobOfRef =
# name:
# { ref, ... }:
# if ((builtins.match "^refs/heads/(.*)$" ref) == null) then
# null
# else
# {
# name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}";
# value = makeJob {
# description = "Branch ${name}";
# flake = "git+ssh://git@github.com/${repo}?ref=${ref}";
# };
# };
# Create a hydra job for a PR
jobOfPR = id: info: {
name = if info.draft then "draft-${id}" else "pr-${id}";
value = makeJob {
description = "PR ${id}: ${info.title}";
flake = "git+ssh://git@github.com/${info.head.repo.full_name}?ref=${info.head.ref}";
flake = "git+ssh://gitea@nayeonie.com:2222/${info.head.repo.full_name}?ref=${info.head.ref}";
};
};
@ -74,12 +73,12 @@ let
# wrapper function for reading json from file
readJSONFile = f: builtins.fromJSON (builtins.readFile f);
# remove null values from a set, in-case of branches that don't exist
mapFilter = f: l: builtins.filter (x: (x != null)) (map f l);
# mapFilter = f: l: builtins.filter (x: (x != null)) (map f l);
# Create job set from PRs and branches
jobs = makeSpec (
builtins.listToAttrs (map ({ name, value }: jobOfPR name value) (attrsToList prs))
// builtins.listToAttrs (mapFilter ({ name, value }: jobOfRef name value) (attrsToList refs))
# // builtins.listToAttrs (mapFilter ({ name, value }: jobOfRef name value) (attrsToList refs))
);
in
{

View File

@ -1,7 +1,7 @@
{
"enabled": 1,
"hidden": false,
"description": "RAD Development infrastructure",
"description": "ahuston-0's personal server infra",
"nixexprinput": "nixexpr",
"nixexprpath": "hydra/jobsets.nix",
"checkinterval": 60,
@ -12,7 +12,7 @@
"type": 0,
"inputs": {
"nixexpr": {
"value": "https://github.com/RAD-Development/nix-dotfiles main",
"value": "ssh://gitea@nayeonie.com:2222/ahuston-0/nix-dotfiles.git main",
"type": "git",
"emailresponsible": false
},
@ -22,13 +22,8 @@
"emailresponsible": false
},
"pulls": {
"type": "githubpulls",
"value": "RAD-Development nix-dotfiles",
"emailresponsible": false
},
"branches": {
"type": "github_refs",
"value": "RAD-Development nix-dotfiles heads -",
"type": "giteapulls",
"value": "nayeonie.com alice nix-dotfiles https",
"emailresponsible": false
}
}