diff --git a/pkg/aspect/lint/bep.go b/pkg/aspect/lint/bep.go index 92586253..140c6d4d 100644 --- a/pkg/aspect/lint/bep.go +++ b/pkg/aspect/lint/bep.go @@ -40,6 +40,7 @@ type ResultForLabel struct { type LintBEPHandler struct { namedSets map[string]*buildeventstream.NamedSetOfFiles workspaceRoot string + localExecRoot string besCompleted chan<- struct{} resultsByLabel map[string]*ResultForLabel } @@ -71,7 +72,14 @@ func (runner *LintBEPHandler) readBEPFile(file *buildeventstream.File) ([]byte, } // Because we set --experimental_remote_download_regex, we can depend on the results file being // in the output tree even when using a remote cache with build without the bytes. - resultsFile = path.Join(runner.workspaceRoot, path.Join(file.PathPrefix...), file.Name) + // If possible, we use the localExecRoot from the workspaceInfo event when constructing the path + // to the results file in case the convenience symlinks are not present, e.g. if + // --experimental_convenience_symlinks=ignore is specified. + root := runner.workspaceRoot + if runner.localExecRoot != "" { + root = runner.localExecRoot + } + resultsFile = path.Join(root, path.Join(file.PathPrefix...), file.Name) } else { return nil, fmt.Errorf("unsupported BES file uri %v", f.Uri) } @@ -122,6 +130,9 @@ func parseLinterMnemonicFromFilename(filename string) string { func (runner *LintBEPHandler) bepEventCallback(event *buildeventstream.BuildEvent) error { switch event.Payload.(type) { + case *buildeventstream.BuildEvent_WorkspaceInfo: + runner.localExecRoot = event.GetWorkspaceInfo().GetLocalExecRoot() + case *buildeventstream.BuildEvent_NamedSetOfFiles: runner.namedSets[event.Id.GetNamedSet().Id] = event.GetNamedSetOfFiles()