diff --git a/pkg/provision/workspace/tokens.go b/pkg/provision/workspace/tokens.go index 0f0cd8339..ccff0c12b 100644 --- a/pkg/provision/workspace/tokens.go +++ b/pkg/provision/workspace/tokens.go @@ -140,11 +140,17 @@ func checkSATokenPathCollisions(saTokens []v1alpha1.ServiceAccountToken, mountPa for _, saToken := range collidingSATokens { problemNames = append(problemNames, saToken.Name) } + sort.Slice(problemNames, func(i, j int) bool { + return problemNames[i] < problemNames[j] + }) if len(problemPaths) == 1 { return fmt.Errorf("the following ServiceAccount tokens have the same path (%s) and mount path (%s): %s", path, mountPath, strings.Join(problemNames, ", ")) } } + sort.Slice(problemNames, func(i, j int) bool { + return problemNames[i] < problemNames[j] + }) return fmt.Errorf("multiple ServiceAccount tokens share the same path and mount path: %s", strings.Join(problemNames, ", ")) } return nil