use hydra from nix-packages
This commit is contained in:
parent
3ce00d2e23
commit
cc1f21aa1e
5 changed files with 108 additions and 153 deletions
112
flake.lock
112
flake.lock
|
@ -1104,6 +1104,30 @@
|
|||
"hydra_2": {
|
||||
"inputs": {
|
||||
"nix": "nix_2",
|
||||
"nixpkgs": [
|
||||
"nix-packages",
|
||||
"hydra",
|
||||
"nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1679916613,
|
||||
"narHash": "sha256-Nj9U0V7Zv7XoRDdO7ECphTk6jHfOgeZe6G0x4FQLpJ0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "hydra",
|
||||
"rev": "082495e34e094cae1eb49dbfc5648938e23c6355",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "hydra",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hydra_3": {
|
||||
"inputs": {
|
||||
"nix": "nix_3",
|
||||
"nixpkgs": [
|
||||
"nixos-config-for-netboot",
|
||||
"hydra",
|
||||
|
@ -1189,6 +1213,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lowdown-src_3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1633514407,
|
||||
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mautrix-cleanup": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
|
@ -1292,17 +1332,18 @@
|
|||
"flake-utils"
|
||||
],
|
||||
"gomod2nix": "gomod2nix",
|
||||
"hydra": "hydra_2",
|
||||
"mautrix-cleanup": "mautrix-cleanup",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682089096,
|
||||
"narHash": "sha256-i2oawywlatcEltb7OP83wf82MN0Byzg4fRMOWyXx67M=",
|
||||
"lastModified": 1682148646,
|
||||
"narHash": "sha256-TCcGQyIbTsIARPWntdSoHSJQA0wEAjxkZfvdbDZC0pM=",
|
||||
"ref": "main",
|
||||
"rev": "c228f9bf9067af5ab8f2e25bb8a5900d031ab248",
|
||||
"revCount": 721,
|
||||
"rev": "1b8ce7f271ac890b5aa14b7eb828311dfb55334c",
|
||||
"revCount": 724,
|
||||
"type": "git",
|
||||
"url": "https://git.chir.rs/darkkirb/nix-packages.git"
|
||||
},
|
||||
|
@ -1346,6 +1387,27 @@
|
|||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-regression": "nixpkgs-regression_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677045134,
|
||||
"narHash": "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nix",
|
||||
"rev": "4acc684ef7b3117c6d6ac12837398a0008a53d85",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "2.13.3",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix_3": {
|
||||
"inputs": {
|
||||
"lowdown-src": "lowdown-src_3",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-regression": "nixpkgs-regression_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1661606874,
|
||||
"narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=",
|
||||
|
@ -1374,10 +1436,10 @@
|
|||
"haskell-flake": "haskell-flake_2",
|
||||
"home-manager": "home-manager_2",
|
||||
"hosts-list": "hosts-list_2",
|
||||
"hydra": "hydra_2",
|
||||
"hydra": "hydra_3",
|
||||
"nix-packages": "nix-packages_2",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-for-crane": "nixpkgs-for-crane",
|
||||
"nixpkgs-noto-variable": "nixpkgs-noto-variable",
|
||||
"nur": "nur",
|
||||
|
@ -1573,6 +1635,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-regression_3": {
|
||||
"locked": {
|
||||
"lastModified": 1643052045,
|
||||
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1675327819,
|
||||
|
@ -1622,6 +1700,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1670461440,
|
||||
"narHash": "sha256-jy1LB8HOMKGJEGXgzFRLDU1CBGL0/LlkolgnqIsF0D8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04a75b2eecc0acf6239acf9dd04485ff8d14f425",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.11-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1657693803,
|
||||
"narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=",
|
||||
|
@ -1637,7 +1731,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1679207639,
|
||||
"narHash": "sha256-4cz3EmZfuYd8BzW1FrSP7Ihb6xzqmz5P7r3EGj0ob5o=",
|
||||
|
@ -1652,7 +1746,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1682137720,
|
||||
"narHash": "sha256-DKMa1doj4CMCJzhzU+G1pAODymlpjTGoLohdaMJ+6Lg=",
|
||||
|
@ -1822,7 +1916,7 @@
|
|||
"nix-packages": "nix-packages",
|
||||
"nixos-config-for-netboot": "nixos-config-for-netboot",
|
||||
"nixos-hardware": "nixos-hardware_2",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixpkgs-for-crane": "nixpkgs-for-crane_2",
|
||||
"nixpkgs-noto-variable": "nixpkgs-noto-variable_2",
|
||||
"nur": "nur_2",
|
||||
|
|
|
@ -69,6 +69,7 @@ rec {
|
|||
inputs.attic.follows = "attic";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.hydra.follows = "hydra";
|
||||
};
|
||||
nixos-config-for-netboot.url = "github:DarkKirb/nixos-config/c9c3d16b23042a25f504a6d71e7075318f1137f8";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
inputs: system: self: prev: let
|
||||
inherit (inputs) nixpkgs nixpkgs-noto-variable nix-packages hydra;
|
||||
inherit (inputs) nixpkgs nixpkgs-noto-variable nix-packages;
|
||||
noto-variable = import nixpkgs-noto-variable {inherit system;};
|
||||
in
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
{
|
||||
hydra-unstable = hydra.packages.${system}.hydra.overrideAttrs (_: {
|
||||
patches = [
|
||||
./hydra-size-limit.patch
|
||||
./hydra-gitea-push-hook.patch
|
||||
];
|
||||
checkPhase = "true";
|
||||
installCheckPhase = "true";
|
||||
});
|
||||
mosh = prev.mosh.overrideAttrs (old: {
|
||||
patches = [
|
||||
./mosh/ssh_path.patch
|
||||
|
@ -33,7 +25,7 @@ in
|
|||
};
|
||||
});
|
||||
inherit (noto-variable) noto-fonts-cjk;
|
||||
nix = prev.nix.overrideAttrs (old: rec {
|
||||
nix = prev.nix.overrideAttrs (old: {
|
||||
postPatchPhase = ''
|
||||
sed 's/getBoolAttr."allowSubstitutes", true./true/' src/libstore/parsed-derivations.cc
|
||||
'';
|
||||
|
@ -41,7 +33,7 @@ in
|
|||
installCheckPhase = "true";
|
||||
});
|
||||
rnix-lsp = with prev;
|
||||
rustPlatform.buildRustPackage rec {
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "rnix-lsp";
|
||||
version = "0.3.0-alejandra";
|
||||
|
||||
|
@ -64,5 +56,6 @@ in
|
|||
maintainers = with maintainers; [ma27];
|
||||
};
|
||||
};
|
||||
hydra-unsstable = nix-packages.packages.${system}.hydra;
|
||||
}
|
||||
// nix-packages.packages.${system}
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
From 750978a19232583e17620a1bd80435e957e7213a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= <sandro.jaeckel@gmail.com>
|
||||
Date: Sat, 18 Jun 2022 13:22:42 +0200
|
||||
Subject: [PATCH 1/2] Add gitea push hook
|
||||
|
||||
---
|
||||
doc/manual/src/webhooks.md | 20 +++++++++++++++++---
|
||||
src/lib/Hydra/Controller/API.pm | 16 ++++++++++++++++
|
||||
src/lib/Hydra/Controller/Root.pm | 3 ++-
|
||||
3 files changed, 35 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/doc/manual/src/webhooks.md b/doc/manual/src/webhooks.md
|
||||
index 2b26cd612..674e1064b 100644
|
||||
--- a/doc/manual/src/webhooks.md
|
||||
+++ b/doc/manual/src/webhooks.md
|
||||
@@ -1,9 +1,12 @@
|
||||
# Webhooks
|
||||
|
||||
-Hydra can be notified by github's webhook to trigger a new evaluation when a
|
||||
+Hydra can be notified by github or gitea with webhooks to trigger a new evaluation when a
|
||||
jobset has a github repo in its input.
|
||||
-To set up a github webhook go to `https://github.com/<yourhandle>/<yourrepo>/settings` and in the `Webhooks` tab
|
||||
-click on `Add webhook`.
|
||||
+
|
||||
+## GitHub
|
||||
+
|
||||
+To set up a webhook for a GitHub repository go to `https://github.com/<yourhandle>/<yourrepo>/settings`
|
||||
+and in the `Webhooks` tab click on `Add webhook`.
|
||||
|
||||
- In `Payload URL` fill in `https://<your-hydra-domain>/api/push-github`.
|
||||
- In `Content type` switch to `application/json`.
|
||||
@@ -11,3 +14,14 @@ click on `Add webhook`.
|
||||
- For `Which events would you like to trigger this webhook?` keep the default option for events on `Just the push event.`.
|
||||
|
||||
Then add the hook with `Add webhook`.
|
||||
+
|
||||
+## Gitea
|
||||
+
|
||||
+To set up a webhook for a Gitea repository go to the settings of the repository in your Gitea instance
|
||||
+and in the `Webhooks` tab click on `Add Webhook` and choose `Gitea` in the drop down.
|
||||
+
|
||||
+- In `Target URL` fill in `https://<your-hydra-domain>/api/push-gitea`.
|
||||
+- Keep HTTP method `POST`, POST Content Type `application/json` and Trigger On `Push Events`.
|
||||
+- Change the branch filter to match the git branch hydra builds.
|
||||
+
|
||||
+Then add the hook with `Add webhook`.
|
||||
diff --git a/src/lib/Hydra/Controller/API.pm b/src/lib/Hydra/Controller/API.pm
|
||||
index 6f10ef575..120735955 100644
|
||||
--- a/src/lib/Hydra/Controller/API.pm
|
||||
+++ b/src/lib/Hydra/Controller/API.pm
|
||||
@@ -285,6 +285,22 @@ sub push_github : Chained('api') PathPart('push-github') Args(0) {
|
||||
$c->response->body("");
|
||||
}
|
||||
|
||||
+sub push_gitea : Chained('api') PathPart('push-gitea') Args(0) {
|
||||
+ my ($self, $c) = @_;
|
||||
+
|
||||
+ $c->{stash}->{json}->{jobsetsTriggered} = [];
|
||||
+
|
||||
+ my $in = $c->request->{data};
|
||||
+ my $url = $in->{repository}->{clone_url} or die;
|
||||
+ print STDERR "got push from Gitea repository $url\n";
|
||||
+
|
||||
+ triggerJobset($self, $c, $_, 0) foreach $c->model('DB::Jobsets')->search(
|
||||
+ { 'project.enabled' => 1, 'me.enabled' => 1 },
|
||||
+ { join => 'project'
|
||||
+ , where => \ [ 'me.flake like ? or exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value like ?)', [ 'flake', "%$url%"], [ 'value', "%$url%" ] ]
|
||||
+ });
|
||||
+ $c->response->body("");
|
||||
+}
|
||||
|
||||
|
||||
1;
|
||||
diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm
|
||||
index c6843d296..1b33db2a6 100644
|
||||
--- a/src/lib/Hydra/Controller/Root.pm
|
||||
+++ b/src/lib/Hydra/Controller/Root.pm
|
||||
@@ -32,6 +32,7 @@ sub noLoginNeeded {
|
||||
|
||||
return $whitelisted ||
|
||||
$c->request->path eq "api/push-github" ||
|
||||
+ $c->request->path eq "api/push-gitea" ||
|
||||
$c->request->path eq "google-login" ||
|
||||
$c->request->path eq "github-redirect" ||
|
||||
$c->request->path eq "github-login" ||
|
||||
@@ -77,7 +78,7 @@ sub begin :Private {
|
||||
$_->supportedInputTypes($c->stash->{inputTypes}) foreach @{$c->hydra_plugins};
|
||||
|
||||
# XSRF protection: require POST requests to have the same origin.
|
||||
- if ($c->req->method eq "POST" && $c->req->path ne "api/push-github") {
|
||||
+ if ($c->req->method eq "POST" && $c->req->path ne "api/push-github" && $c->req->path ne "api/push-gitea") {
|
||||
my $referer = $c->req->header('Referer');
|
||||
$referer //= $c->req->header('Origin');
|
||||
my $base = $c->req->base;
|
||||
|
||||
From a81c6a3a80d1055aa80934ab229e2dc49594edd2 Mon Sep 17 00:00:00 2001
|
||||
From: Sandro <sandro.jaeckel@gmail.com>
|
||||
Date: Fri, 1 Jul 2022 22:21:32 +0200
|
||||
Subject: [PATCH 2/2] Match URIs that don't end in .git
|
||||
|
||||
Co-authored-by: Charlotte <lotte@chir.rs>
|
||||
---
|
||||
src/lib/Hydra/Controller/API.pm | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/lib/Hydra/Controller/API.pm b/src/lib/Hydra/Controller/API.pm
|
||||
index 120735955..5eeb0c04b 100644
|
||||
--- a/src/lib/Hydra/Controller/API.pm
|
||||
+++ b/src/lib/Hydra/Controller/API.pm
|
||||
@@ -292,6 +292,7 @@ sub push_gitea : Chained('api') PathPart('push-gitea') Args(0) {
|
||||
|
||||
my $in = $c->request->{data};
|
||||
my $url = $in->{repository}->{clone_url} or die;
|
||||
+ $url =~ s/.git$//;
|
||||
print STDERR "got push from Gitea repository $url\n";
|
||||
|
||||
triggerJobset($self, $c, $_, 0) foreach $c->model('DB::Jobsets')->search(
|
|
@ -1,16 +0,0 @@
|
|||
diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc
|
||||
index 21a6c331..05380681 100644
|
||||
--- a/src/hydra-queue-runner/build-remote.cc
|
||||
+++ b/src/hydra-queue-runner/build-remote.cc
|
||||
@@ -468,11 +468,6 @@ void State::buildRemote(ref<Store> destStore,
|
||||
infos.insert_or_assign(info.path, info);
|
||||
}
|
||||
|
||||
- if (totalNarSize > maxOutputSize) {
|
||||
- result.stepStatus = bsNarSizeLimitExceeded;
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
/* Copy each path. */
|
||||
printMsg(lvlDebug, "copying outputs of ‘%s’ from ‘%s’ (%d bytes)",
|
||||
localStore->printStorePath(step->drvPath), machine->sshName, totalNarSize);
|
Loading…
Reference in a new issue