RunCommand: Add a WIP execution of dynamic commands
This in-progress feature will run a dynamically generated set of buildFinished hooks, which must be nested under the `runCommandHook.*` attribute set. This implementation is not very good, with some to-dos: 1. Only run if the build succeeded 2. Verify the output is named $out and that it is an executable file (or a symlink to a file) 3. Require the jobset itself have a flag enabling the feature, since this feature can be a bit dangerous if various people of different trust levels can create the jobs.
This commit is contained in:
27
t/jobs/runcommand-dynamic.nix
Normal file
27
t/jobs/runcommand-dynamic.nix
Normal file
@ -0,0 +1,27 @@
|
||||
with import ./config.nix;
|
||||
{
|
||||
runCommandHook.example = mkDerivation
|
||||
{
|
||||
name = "my-build-product";
|
||||
builder = "/bin/sh";
|
||||
outputs = [ "out" "bin" ];
|
||||
args = [
|
||||
(
|
||||
builtins.toFile "builder.sh" ''
|
||||
#! /bin/sh
|
||||
|
||||
echo "$PATH"
|
||||
|
||||
mkdir $bin
|
||||
echo "foo" > $bin/bar
|
||||
|
||||
metrics=$out/nix-support/hydra-metrics
|
||||
mkdir -p "$(dirname "$metrics")"
|
||||
echo "lineCoverage 18 %" >> "$metrics"
|
||||
echo "maxResident 27 KiB" >> "$metrics"
|
||||
''
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user