bottlerocket-os / bottlerocket-update-operator

A Kubernetes operator for automated updates to Bottlerocket
Other
178 stars 41 forks source link

Fix CI build to unblock dependabots #659

Closed ytsssun closed 3 months ago

ytsssun commented 3 months ago

Issue number: Fix the CI to unblock PRs: https://github.com/bottlerocket-os/bottlerocket-update-operator/pull/658 https://github.com/bottlerocket-os/bottlerocket-update-operator/pull/657 https://github.com/bottlerocket-os/bottlerocket-update-operator/pull/656 https://github.com/bottlerocket-os/bottlerocket-update-operator/pull/654

Description of changes: I am seeing build failures when running make build with the latest rustc version (rustup update stable to update).

Failure 1: Starting with Rust 1.80 (or nightly-2024-05-05) every reachable #[cfg] will be automatically checked that they match the expected config names and values. See more details in this blog.

Our CI build failed with

error: unexpected `cfg` condition name: `mockall`
 --> apiserver/src/auth/mod.rs:9:11
  |
9 | #[cfg(any(mockall, test))]
  |           ^^^^^^^ help: found config with similar value: `feature = "mockall"`

One way to fix it is to add the lints table in Cargo.toml.

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mockall)'] }

But we are using feature = "mockall" everywhere else, so making the change for consistency.

Failure 2: Also with the Rust 1.80 release, there is another linter error clippy::needless_borrows_for_generic_args (See more details here).

error: the borrowed expression implements the required traits
   --> integ/src/nodegroup_provider.rs:366:20
    |
366 |         .role_name(&iam_instance_profile_name.clone())
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `iam_instance_profile_name.clone()`

Testing done: make build passed.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.