From the hydra configuration file.
The configuration is loaded from the "git-input" block. Currently only the "timeout" variable is been looked up in the file.
<git-input>
timeout = 400 <input-name> # specific timeout for a particular input name timeout = 400 </input-name>
<"foot with spaces"> # specific timeout for a particular input name timeout = 400 </"foo with spaces"> </git-input>
As an argument in the input value after the repo url and branch (and after the deepClone if is defined) "timeout=<value>"
The preference on which value is used:
The code is generalized for more values to be configured, it might be too much for a single value on a single plugin.
34SOPSVFSYMJ4BTJBGREAU4H2LHFWI2GKTGZ6R3B4CTUITMVX35QC return ($uri, $branch, $deepClone);
my $options = {};my $start_options = 3;# if deepClone has "=" then is considered an option# and not the enabling of deepCloneif (index($deepClone, "=") != -1) {undef $deepClone;$start_options = 2;}foreach my $option (@parts[$start_options .. $#parts]) {(my $key, my $value) = split('=', $option);$options->{$key} = $value;}return ($uri, $branch, $deepClone, $options);}sub _printIfDebug {my ($msg) = @_;print STDERR "GitInput: $msg" if $ENV{'HYDRA_DEBUG'};}=item _pluginConfig($main_config, $input_name)Read the configuration from the main hydra config file.The configuration is loaded from the "git-input" block.Currently only the "timeout" variable is been looked up in the file.The variables defined directly in the input value will overridethe ones on the configuration file, to define the variablesas an input value use: <name>=<value> without spaces andspecify at least he repo url and branch.<git-input># general timeouttimeout = 400<input-name># specific timeout for a particular input nametimeout = 400</input-name># use quotes when the input name has spaces<"foot with spaces"># specific timeout for a particular input nametimeout = 400</"foo with spaces"></git-input>=cutsub _pluginConfig {my ($main_config, $input_name) = @_;my $cfg = $main_config->{$CONFIG_SECTION};# default valuesmy $values = {timeout => 600,};unless (defined $cfg) {_printIfDebug "Unable to load $CONFIG_SECTION section\n";_printIfDebug "Using default values\n";return $values;} else {_printIfDebug "Parsing plugin configuration: ";_printIfDebug Dumper($cfg);}if (defined $cfg->{$input_name} and %{$cfg->{$input_name}}) {_printIfDebug "Merging sections for $input_name\n";$cfg = {%{$cfg}, %{$cfg->{$input_name}}}; # merge with precedense to the input name}if (exists $cfg->{timeout}) {$values->{timeout} = int($cfg->{timeout});_printIfDebug "Using custom timeout for $input_name:";} else {_printIfDebug "Using default timeout for $input_name:";}_printIfDebug "$values->{timeout}\n";return $values;
my ($uri, $branch, $deepClone) = _parseValue($value);
my ($uri, $branch, $deepClone, $options) = _parseValue($value);my $cfg = _pluginConfig($self->{config}, $name);# give preference to the options from the input valuewhile (my ($opt_name, $opt_value) = each %{$options}) {if ($opt_value =~ /\d+/) {$opt_value = int($opt_value);}$cfg->{$opt_name} = $opt_value;_printIfDebug "'$name': override '$opt_name' with input value: $opt_value\n";}
$res = run(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$localBranch"], dir => $clonePath, timeout => 600);$res = run(cmd => ["git", "fetch", "-fu", "origin"], dir => $clonePath, timeout => 600) if $res->{status};
$res = run(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$localBranch"], dir => $clonePath,timeout => $cfg->{timeout});$res = run(cmd => ["git", "fetch", "-fu", "origin"], dir => $clonePath, timeout => $cfg->{timeout}) if $res->{status};