forked from lix-project/hydra
Only run dynamic runcommand hooks if the jobset enables them
This commit is contained in:
parent
97a1d2d1d4
commit
3cce0c5ef6
|
@ -71,7 +71,9 @@ sub isBuildEligibleForDynamicRunCommand {
|
|||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
if ($build->jobset->enable_dynamic_run_command) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -136,9 +138,6 @@ sub fanoutToCommands {
|
|||
|
||||
# Calculate all dynamically defined commands to execute
|
||||
if (areDynamicCommandsEnabled($config)) {
|
||||
# missing test cases:
|
||||
#
|
||||
# 1. is it enabled on the jobset?
|
||||
if (isBuildEligibleForDynamicRunCommand($build)) {
|
||||
my $job = $build->get_column('job');
|
||||
my $out = $build->buildoutputs->find({name => "out"});
|
||||
|
|
|
@ -13,6 +13,9 @@ my $builds = $ctx->makeAndEvaluateJobset(
|
|||
|
||||
my $build = $builds->{"runCommandHook.example"};
|
||||
|
||||
# Enable dynamic runcommand on the jobset
|
||||
$build->jobset->update({enable_dynamic_run_command => 1});
|
||||
|
||||
is($build->job, "runCommandHook.example", "The only job should be runCommandHook.example");
|
||||
is($build->finished, 1, "Build should be finished.");
|
||||
is($build->buildstatus, 0, "Build should have buildstatus 0.");
|
||||
|
@ -167,6 +170,16 @@ subtest "isBuildEligibleForDynamicRunCommand" => sub {
|
|||
"Failed builds don't get run"
|
||||
);
|
||||
};
|
||||
|
||||
subtest "With dynamic runcommand disabled ..." => sub {
|
||||
$build->jobset->update({enable_dynamic_run_command => 0});
|
||||
|
||||
is(
|
||||
Hydra::Plugin::RunCommand::isBuildEligibleForDynamicRunCommand($builds->{"runCommandHook.example"}),
|
||||
0,
|
||||
"Builds don't run from a jobset with disabled dynamic runcommand"
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue