Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions bobtask/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,7 @@ func (t *Task) description() string {
// env is influenced by t.dependencies, so no need to hash t.dependencies
sort.Strings(t.env)
for _, v := range t.env {
// ignore buildCommandPath and SHLVL due to non-reproducibility
v = strings.ToLower(v)
if strings.HasPrefix(v, "buildcommandpath=") {
continue
}
if strings.HasPrefix(v, "shlvl=") {
if shouldIgnore(v) {
continue
}
sb.WriteString(v)
Expand All @@ -214,3 +209,28 @@ func (t *Task) description() string {

return sb.String()
}

// shouldIgnore checks if the key-value env pair
// should be ignored from the task description due to non-reproducibility
func shouldIgnore(v string) bool {
v = strings.ToLower(v)
if strings.HasPrefix(v, "buildcommandpath=") {
return true
}
if strings.HasPrefix(v, "shlvl=") {
return true
}
if strings.HasPrefix(v, "home=") {
return true
}
if strings.HasPrefix(v, "logname=") {
return true
}
if strings.HasPrefix(v, "pwd=") {
return true
}
if strings.HasPrefix(v, "user=") {
return true
}
return false
}