Skip to content

Treat warnings in Bazel builds as errors #1779

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

Closed
wants to merge 1 commit into from

Conversation

aaronmondal
Copy link
Contributor

@aaronmondal aaronmondal commented May 17, 2025

Bazel's incremental caching doesn't rerun actions that only emit warnings. That's inconvenient as these warnings will only be shown once during the initial invocation but not in following invocations which treat the action as successfull run. This leads to friction where a passing local build won't necessarily pass CI.

We now treat all warnings as hard errors. The more natural approach to temporarily skip over warnings in Bazel is via -k (or --keep_going).


This change is Reviewable

Copy link
Contributor Author

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@jaroeichler Follow-up on #1778 (review)

Reviewable status: 0 of 1 LGTMs obtained, and 0 of 1 files reviewed, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / macos-15, Bazel Dev / ubuntu-24.04, Cargo Dev / macos-15, Cargo Dev / ubuntu-24.04, Coverage, Installation / macos-14, Installation / macos-15, Installation / ubuntu-22.04, Installation / ubuntu-24.04, Local / bazel / ubuntu-24.04, Local / lre-cc / ubuntu-24.04, Local / lre-rs / macos-15, Local / lre-rs / ubuntu-24.04, NativeLink.com Cloud / Remote Cache / macos-15, NativeLink.com Cloud / Remote Cache / ubuntu-24.04, Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / lre-cc / xlarge-ubuntu-24.04, Remote / lre-rs / xlarge-ubuntu-24.04, asan / ubuntu-24.04, buildstream, integration-tests (24.04), macos-15, pre-commit-checks, ubuntu-24.04, ubuntu-24.04 / stable, vale, windows-2022 / stable (waiting on @jaroeichler)

Copy link
Contributor Author

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 LGTMs obtained, and 0 of 2 files reviewed, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / macos-15, Bazel Dev / ubuntu-24.04, Cargo Dev / macos-15, Cargo Dev / ubuntu-24.04, Coverage, Installation / macos-14, Installation / macos-15, Installation / ubuntu-22.04, Installation / ubuntu-24.04, Local / bazel / ubuntu-24.04, Local / lre-cc / ubuntu-24.04, Local / lre-rs / macos-15, Local / lre-rs / ubuntu-24.04, NativeLink.com Cloud / Remote Cache / macos-15, NativeLink.com Cloud / Remote Cache / ubuntu-24.04, Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / lre-cc / xlarge-ubuntu-24.04, Remote / lre-rs / xlarge-ubuntu-24.04, asan / ubuntu-24.04, buildstream, integration-tests (24.04), macos-15, pre-commit-checks, ubuntu-24.04, ubuntu-24.04 / stable, vale, windows-2022 / stable (waiting on @jaroeichler)


nativelink-util/src/fs.rs line 215 at r1 (raw file):

    let (permit, os_file) = call_with_permit(move |permit| {
        let mut os_file =
            std::fs::File::open(&path).err_tip(|| format!("Could not open {}", path.display()))?;

FYI these hare hotfixes for https://github.com/TraceMachina/nativelink/actions/runs/15086221164/job/42409066332?pr=1779.

Copy link
Contributor

@jaroeichler jaroeichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: asan / ubuntu-24.04

Copy link
Contributor

@jhpratt jhpratt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel's incremental caching doesn't rerun actions that only emit warnings.

I presume there's no easy(ish) way to make this be the case?

Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: asan / ubuntu-24.04

Copy link
Contributor Author

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume there's no easy(ish) way to make this be the case?

Not that I'm aware of. I believe this is the same issue that requires C++ builds to run with -Werror (warnings-as-errors) so that they don't get lost in the cache.

Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: asan / ubuntu-24.04

Bazel's incremental caching doesn't rerun actions that only emit
warnings. That's inconvenient as these warnings will only be shown once
during the initial invocation but not in following invocations which
treat the action as successfull run. This leads to friction where a
passing local build won't necessarily pass CI.

We now treat all warnings as hard errors. The more natural approach to
temporarily skip over warnings in Bazel is via `-k` (or `--keep_going`).
@palfrey
Copy link
Collaborator

palfrey commented Jun 10, 2025

The remaining build issues here appear to be due to rust-lang/rust-clippy#14850 and so we probably just need to set rust-version = "1.87.0" in the packages to sort this one out I think. I can't get the asan profile to run locally though for some reason, so can't check this.

@palfrey
Copy link
Collaborator

palfrey commented Jun 26, 2025

Closed in favour of #1840

@palfrey palfrey closed this Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants