Add $ anchor to log file regexps
Signed-off-by: Babak K. Shandiz <babakks@github.com> This is to make sure we do not pick up the wrong file if there is a `.txt` sequence in the middle of a job name.
This commit is contained in:
parent
2d21b4624c
commit
b65286125b
1 changed files with 3 additions and 3 deletions
|
|
@ -555,7 +555,7 @@ func getJobNameForLogFilename(name string) string {
|
|||
// number; e.g., "0_jobname.txt".
|
||||
func jobLogFilenameRegexp(job shared.Job) *regexp.Regexp {
|
||||
sanitizedJobName := getJobNameForLogFilename(job.Name)
|
||||
re := fmt.Sprintf(`^\d+_%s\.txt`, regexp.QuoteMeta(sanitizedJobName))
|
||||
re := fmt.Sprintf(`^\d+_%s\.txt$`, regexp.QuoteMeta(sanitizedJobName))
|
||||
return regexp.MustCompile(re)
|
||||
}
|
||||
|
||||
|
|
@ -563,13 +563,13 @@ func jobLogFilenameRegexp(job shared.Job) *regexp.Regexp {
|
|||
// negative number which is the ID of the run; e.g., "-2147483648_jobname.txt".
|
||||
func legacyJobLogFilenameRegexp(job shared.Job) *regexp.Regexp {
|
||||
sanitizedJobName := getJobNameForLogFilename(job.Name)
|
||||
re := fmt.Sprintf(`^-\d+_%s\.txt`, regexp.QuoteMeta(sanitizedJobName))
|
||||
re := fmt.Sprintf(`^-\d+_%s\.txt$`, regexp.QuoteMeta(sanitizedJobName))
|
||||
return regexp.MustCompile(re)
|
||||
}
|
||||
|
||||
func stepLogFilenameRegexp(job shared.Job, step shared.Step) *regexp.Regexp {
|
||||
sanitizedJobName := getJobNameForLogFilename(job.Name)
|
||||
re := fmt.Sprintf(`^%s\/%d_.*\.txt`, regexp.QuoteMeta(sanitizedJobName), step.Number)
|
||||
re := fmt.Sprintf(`^%s\/%d_.*\.txt$`, regexp.QuoteMeta(sanitizedJobName), step.Number)
|
||||
return regexp.MustCompile(re)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue