Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bazel command to explicit command line for workflows #8383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions app/invocation/child_invocation_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default class ChildInvocationCard extends React.Component<ChildInvocation
}
}

private stripFirstWordIfBazelBinary(command: string): string {
return command.replace(/^\s*\S*(?:\/|^)bazel(?:isk)?\s+/, "");
}

render() {
const inv = this.props.invocation;
const invModel = new InvocationModel(inv);
Expand All @@ -62,6 +66,7 @@ export default class ChildInvocationCard extends React.Component<ChildInvocation
if (command == "") {
command = `${inv.command} ${inv.pattern.join(" ")}`;
}
command = this.stripFirstWordIfBazelBinary(command);

return (
<Link
Expand Down
8 changes: 4 additions & 4 deletions enterprise/server/cmd/ci_runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2544,10 +2544,7 @@ func runBazelWrapper() error {
// Pass the original command as metadata, stripping the custom flags we've set,
// so that it can be displayed in the UI
filteredOriginalArgs := make([]string, 0, len(originalArgs))
for i, arg := range originalArgs {
if i == 0 && (arg == bazelBinaryName || arg == bazeliskBinaryName) {
continue
}
for _, arg := range originalArgs {
if strings.Contains(arg, "--invocation_id") ||
strings.Contains(arg, "--remote_header=") ||
strings.Contains(arg, "--config=buildbuddy_remote_cache") ||
Expand All @@ -2557,6 +2554,9 @@ func runBazelWrapper() error {
}
filteredOriginalArgs = append(filteredOriginalArgs, arg)
}
if len(filteredOriginalArgs) > 0 && filteredOriginalArgs[0] != bazelBin {
filteredOriginalArgs = append([]string{bazelBin}, filteredOriginalArgs...)
}
originalArgsJSON, err := json.Marshal(filteredOriginalArgs)
if err != nil {
return err
Expand Down
Loading