uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
48
nixos/tests/hydra/common.nix
Normal file
48
nixos/tests/hydra/common.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ system, ... }:
|
||||
{
|
||||
baseConfig = { pkgs, ... }: let
|
||||
trivialJob = pkgs.writeTextDir "trivial.nix" ''
|
||||
{ trivial = builtins.derivation {
|
||||
name = "trivial";
|
||||
system = "${system}";
|
||||
builder = "/bin/sh";
|
||||
allowSubstitutes = false;
|
||||
preferLocalBuild = true;
|
||||
args = ["-c" "echo success > $out; exit 0"];
|
||||
};
|
||||
}
|
||||
'';
|
||||
|
||||
createTrivialProject = pkgs.stdenv.mkDerivation {
|
||||
name = "create-trivial-project";
|
||||
dontUnpack = true;
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh";
|
||||
postFixup = ''
|
||||
wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob}
|
||||
'';
|
||||
};
|
||||
in {
|
||||
virtualisation.memorySize = 2048;
|
||||
time.timeZone = "UTC";
|
||||
environment.systemPackages = [ createTrivialProject pkgs.jq ];
|
||||
services.hydra = {
|
||||
enable = true;
|
||||
# Hydra needs those settings to start up, so we add something not harmfull.
|
||||
hydraURL = "example.com";
|
||||
notificationSender = "example@example.com";
|
||||
extraConfig = ''
|
||||
email_notification = 1
|
||||
'';
|
||||
};
|
||||
services.postfix.enable = true;
|
||||
nix = {
|
||||
distributedBuilds = true;
|
||||
buildMachines = [{
|
||||
hostName = "localhost";
|
||||
systems = [ system ];
|
||||
}];
|
||||
settings.substituters = [];
|
||||
};
|
||||
};
|
||||
}
|
||||
59
nixos/tests/hydra/create-trivial-project.sh
Executable file
59
nixos/tests/hydra/create-trivial-project.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script creates a project, a jobset with an input of type local
|
||||
# path. This local path is a directory that contains a Nix expression
|
||||
# to define a job.
|
||||
# The EXPR-PATH environment variable must be set with the local path.
|
||||
|
||||
set -e
|
||||
|
||||
URL=http://localhost:3000
|
||||
USERNAME="admin"
|
||||
PASSWORD="admin"
|
||||
PROJECT_NAME="trivial"
|
||||
JOBSET_NAME="trivial"
|
||||
EXPR_PATH=${EXPR_PATH:-}
|
||||
|
||||
if [ -z $EXPR_PATH ]; then
|
||||
echo "Environment variable EXPR_PATH must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mycurl() {
|
||||
curl --referer $URL -H "Accept: application/json" -H "Content-Type: application/json" $@
|
||||
}
|
||||
|
||||
cat >data.json <<EOF
|
||||
{ "username": "$USERNAME", "password": "$PASSWORD" }
|
||||
EOF
|
||||
mycurl -X POST -d '@data.json' $URL/login -c hydra-cookie.txt
|
||||
|
||||
cat >data.json <<EOF
|
||||
{
|
||||
"displayname":"Trivial",
|
||||
"enabled":"1",
|
||||
"visible":"1"
|
||||
}
|
||||
EOF
|
||||
mycurl --silent -X PUT $URL/project/$PROJECT_NAME -d @data.json -b hydra-cookie.txt
|
||||
|
||||
cat >data.json <<EOF
|
||||
{
|
||||
"description": "Trivial",
|
||||
"checkinterval": "60",
|
||||
"enabled": "1",
|
||||
"visible": "1",
|
||||
"keepnr": "1",
|
||||
"enableemail": true,
|
||||
"emailoverride": "hydra@localhost",
|
||||
"nixexprinput": "trivial",
|
||||
"nixexprpath": "trivial.nix",
|
||||
"inputs": {
|
||||
"trivial": {
|
||||
"value": "$EXPR_PATH",
|
||||
"type": "path"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
mycurl --silent -X PUT $URL/jobset/$PROJECT_NAME/$JOBSET_NAME -d @data.json -b hydra-cookie.txt
|
||||
59
nixos/tests/hydra/default.nix
Normal file
59
nixos/tests/hydra/default.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, config ? { }
|
||||
, pkgs ? import ../../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
with import ../../lib/testing-python.nix { inherit system pkgs; };
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
inherit (import ./common.nix { inherit system; }) baseConfig;
|
||||
|
||||
hydraPkgs = {
|
||||
inherit (pkgs) hydra_unstable;
|
||||
};
|
||||
|
||||
makeHydraTest = with pkgs.lib; name: package: makeTest {
|
||||
name = "hydra-${name}";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ lewo ma27 ];
|
||||
};
|
||||
|
||||
nodes.machine = { pkgs, lib, ... }: {
|
||||
imports = [ baseConfig ];
|
||||
services.hydra = { inherit package; };
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
# let the system boot up
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
# test whether the database is running
|
||||
machine.wait_for_unit("postgresql.service")
|
||||
# test whether the actual hydra daemons are running
|
||||
machine.wait_for_unit("hydra-init.service")
|
||||
machine.require_unit_state("hydra-queue-runner.service")
|
||||
machine.require_unit_state("hydra-evaluator.service")
|
||||
machine.require_unit_state("hydra-notify.service")
|
||||
|
||||
machine.succeed("hydra-create-user admin --role admin --password admin")
|
||||
|
||||
# create a project with a trivial job
|
||||
machine.wait_for_open_port(3000)
|
||||
|
||||
# make sure the build as been successfully built
|
||||
machine.succeed("create-trivial-project.sh")
|
||||
|
||||
machine.wait_until_succeeds(
|
||||
'curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'
|
||||
)
|
||||
|
||||
machine.wait_until_succeeds(
|
||||
'journalctl -eu hydra-notify.service -o cat | grep -q "sending mail notification to hydra@localhost"'
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
mapAttrs makeHydraTest hydraPkgs
|
||||
Loading…
Add table
Add a link
Reference in a new issue