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.
This commit is contained in:
@ -19,6 +19,8 @@ our @EXPORT = qw(
|
||||
cancelBuilds
|
||||
captureStdoutStderr
|
||||
captureStdoutStderrWithStdin
|
||||
constructRunCommandLogFilename
|
||||
constructRunCommandLogPath
|
||||
findLog
|
||||
gcRootFor
|
||||
getBaseUrl
|
||||
@ -589,4 +591,20 @@ sub isLocalStore {
|
||||
}
|
||||
|
||||
|
||||
sub constructRunCommandLogFilename {
|
||||
my ($sha, $build_id) = @_;
|
||||
my $filename = "$sha-$build_id";
|
||||
return $filename;
|
||||
}
|
||||
|
||||
|
||||
sub constructRunCommandLogPath {
|
||||
my ($filename) = @_;
|
||||
|
||||
my $hydra_path = Hydra::Model::DB::getHydraPath;
|
||||
my $bucket = substr($filename, 0, 2);
|
||||
|
||||
return "$hydra_path/runcommand-logs/$bucket/$filename";
|
||||
}
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user