379 Commits

Author SHA1 Message Date
Cole Helbling
61189ecca9 Helper/Nix: constructRunCommandLogPath: verify uuid is valid
This shouldn't be possible normally, but it is possible to:

    $db->resultset('RunCommandLogs')->new({ uuid => "../etc/passwd" });

if you have access to the `$db`.
2022-01-31 08:58:33 -08:00
Cole Helbling
e381751564 Helper/Nix: constructRunCommandLogPath: return undef in case of an error
This allows us to give a web request to an invalid UUID a 404.
2022-01-31 08:58:33 -08:00
Cole Helbling
8eab7b8543 Helper/Nix: constructRunCommandLogPath: take RunCommandLog as input
This way we ensure that it actually exists in the database, rather than
blindly trusting user-generated input.
2022-01-31 08:58:33 -08:00
Cole Helbling
fc3cf4ecb2 RunCommandLogs: identify and access via uuid
Using a sha1 of the command combined with the build ID is not a
particularly good or unique identifier:

* A build could fail, be restarted, and then succeed -- assuming no
configuration changes, the sha1 hash of the command as well as the build
ID will be the same. This would lead to an overwritten log file.

* Allowing user input to influence filenames is not the best of ideas.
2022-01-31 08:58:33 -08:00
Cole Helbling
5d3912962b RunCommand: use helper functions to ensure filenames and paths are the same
Otherwise, it's possible someone updates the format in one place but not
the others, leading to broken or incorrect functionality.
2022-01-28 13:03:15 -08:00
Graham Christensen
3a6c25489c Hydra::Helper::Nix: expose a captureStdoutStderrWithStdin, make it available in tests 2022-01-21 10:40:06 -05:00
Graham Christensen
d4fe7e55dd Hydra::Helper::Nix: sort exported functions 2022-01-21 10:40:06 -05:00
Graham Christensen
97596c3e93 buildListColumns: remove project, jobset. 2022-01-14 12:48:48 -05:00
Graham Christensen
2803f06e6e CatalystUtils::buildListColumns: add jobset_id 2022-01-14 11:28:39 -05:00
Graham Christensen
5c5ecdb9fc Helper::Nix::isLocalStore: a file store is local 2022-01-14 11:28:39 -05:00
Graham Christensen
f30ca3c423 showJobName: use jobset/project columns 2022-01-11 11:51:31 -05:00
Graham Christensen
ceb6ea252a CatalystUtils.pm: don't use Hydra::Helper::Nix
Using it causes database information to get fixated early, before tests can set a
new database. We only used it in one case, and that is an absolute reference anyway. The
tests for channel generation are passing, and that uses
[requireLocalStore, so this should be fine.
2022-01-11 11:47:42 -05:00
Cole Helbling
9b12a88d81 BuildDiff: ensure buildstatus is defined
buildstatus won't be defined if e.g. a build is queued but none have
failed.
2022-01-10 12:11:06 -08:00
Cole Helbling
b98dbe01c3 BuildDiff: slight cleanup
Remove debugging Data::Dumper import, make comment describing function
inputs more readable.
2022-01-10 12:11:06 -08:00
Cole Helbling
98375e9086 BuildDiff: bring back the sort 2022-01-10 12:11:05 -08:00
Cole Helbling
ceb81e7d78 BuildDiff: actual list reference to $builds2 2022-01-10 12:11:05 -08:00
Cole Helbling
458214381d BuildDiff: document what the inputs mean
They were tripping me up, so it helped to know exactly what they were at
the ~point they're used.
2022-01-10 12:11:05 -08:00
Cole Helbling
ff12218d02 BuildDiff: cleanup imports and make slightly more readable 2022-01-10 12:11:05 -08:00
Cole Helbling
ec98bdaaaa BuildDiff: move cmdBuilds from Controller/JobsetEval 2022-01-10 12:11:05 -08:00
Cole Helbling
0c51f3ca7d BuildDiff: make actual hash ref 2022-01-10 12:11:05 -08:00
Cole Helbling
1349887974 BuildDiff: split out from JobsetEval GET impl 2022-01-10 12:11:05 -08:00
Graham Christensen
e43f487157 perlcritic: return undef in list context too 2021-12-14 10:24:53 -05:00
Graham Christensen
a658b80863 perlcritic: Readonly -> ReadonlyX 2021-12-14 10:16:25 -05:00
Graham Christensen
30a7f068b7 AttributeSet helper: skip wantarray 2021-12-14 10:16:25 -05:00
Graham Christensen
d2f03ca050 fixup foreach 2021-12-14 10:16:25 -05:00
Graham Christensen
4dfe787bc2 perlcritic: each() called at line 752, column 35. The each function may cause undefined behavior when operating on the hash while iterating. Use a foreach loop over the hash's keys or values instead. 2021-12-14 10:16:25 -05:00
Graham Christensen
7dcf6a01c6 JSON -> JSON::MaybeXS 2021-12-13 15:37:56 -05:00
Cole Helbling
d56815cae6 Hydra/Helper/CatalystUtils: default trim arg to empty string
12:34:12 hydra-server.1       | Use of uninitialized value $s in substitution (s///) at /home/vin/workspace/vcs/hydra/src/script/../lib/Hydra/Helper/CatalystUtils.pm line 283, <$fh> line 1.
2021-11-30 13:10:31 -08:00
Graham Christensen
5fbf1470bd (perl) machines file: support machine lines with multiple spaces between fields 2021-10-24 21:30:53 -04:00
Graham Christensen
b817124337 Hydra::Helper::Nix::getMachines: add a test
Fix parsing breakage from #1003: assigning the lines to $lines broke chomp and the filters.

This test validates the parsing works as expected, and also fixes
a minor bug where '-' in features isn't pruned, like in the C++
repo.
2021-10-23 22:53:55 -04:00
Graham Christensen
d98d74fa4f perlcritic: doesn't like prototypes 2021-10-20 13:09:39 -04:00
Graham Christensen
7095d00608 perlcritic: make all open() calls three-argument
Two-argument calls end up parsing the second argument to guess what
should happen, three-arg parses ... less?
2021-10-20 13:09:39 -04:00
Graham Christensen
741590c923 perlcritic: explicitly assign the result of readdir/file reads 2021-09-07 21:55:55 -04:00
Graham Christensen
c603ae35f0 perlcritic: Don't conditionally declare variables 2021-09-07 21:35:01 -04:00
Graham Christensen
21e1ff0da1 perlcritic: don't open files as bare words 2021-09-06 22:20:17 -04:00
Graham Christensen
efd1d78b97 Hydra::Helper::Nix: getHydraNotifyPrometheusConfig fixup strict warning around double-declaring cfg 2021-09-06 22:13:33 -04:00
Graham Christensen
c880888f1e File::Slurp -> File::Slurper 2021-09-06 22:13:33 -04:00
Your Name
c54629b732 Helper/Nix.pm: perlcritic statsd in scalar context 2021-09-06 22:13:33 -04:00
Your Name
4677a7c894 perlcritic: use strict, use warnings 2021-09-06 22:13:33 -04:00
Graham Christensen
dd06ab7a99 Merge pull request #1004 from DeterminateSystems/avoid-a-b
Avoid $a, $b
2021-09-06 21:35:17 -04:00
Your Name
24467a7bde Nix::getHydraNotifyPrometheusConfig: print errors if the configuration provided is invalid. 2021-08-24 11:35:38 -04:00
Your Name
6d7ee27d25 hydra-notify: make the prometheus endpoint configurable, default-off 2021-08-24 10:56:13 -04:00
Graham Christensen
1cda08351f CatalystUtils: rename $b to $builds (perlcritic) 2021-08-20 21:52:32 -04:00
Your Name
4632132d02 fixup perlcritic: indirect new
> Subroutine new called using indirect syntax at line 14, column 14.  See page 349 of PBP.  (Severity: 5)
2021-08-20 11:39:19 -04:00
Shay Bergmann
503b0e0b6f
Remove unnecessary comment 2021-07-26 17:16:40 +00:00
Shay Bergmann
173ecb5d92
Apply requested changes to Config.pm 2021-07-26 17:16:40 +00:00
Shay Bergmann
4f95774ca3
Factor out common options 2021-07-26 03:43:09 +00:00
Shay Bergmann
e98bd0ec8d
Comment around dupe to avoid drift 2021-07-22 23:27:21 -04:00
Graham Christensen
09ad52ab60 Document getEvals a bit
Also drop the $self parameter.

Co-authored-by: gustavderdrache
2021-06-16 13:15:01 -04:00
Graham Christensen
5d95abf540 getBuilds: clarify the names of evals vs. the query builder 2021-06-16 11:53:04 -04:00