Skip to content

Commit 1799955

Browse files
authored
Externalize -Dwarnings outside Dockerfile (#4209)
## Motivation and Context Previously, our Docker image configurations had different warning handling for internal and external use: - External images (used in smithy-rs CI): Treated warnings as errors - Internal images: Ignored warnings Now that we've unified our Docker image for both internal and external use, internal tests have inherited the stricter warning handling. This has caused unwanted test failures within our release pipeline. This PR moves `-Dwarnings` (warning as error) outside of the Docker image, allowing the environment executing a Docker container to control whether warnings should be treated as errors. With this change, warnings won't be treated as errors in Docker containers themselves. The smithy-rs CI can set those flags to treat warnings as errors, and the release pipeline does not set the flags to continue ignoring warnings. ## Testing After having externalized `-Dwarnings` outside the Docker image, confirmed that the smithy-r CI replicates the same set of errors with a fake change that introduced an intentional `unused` clippy warning ([main branch with a fake change](https://github.com/smithy-lang/smithy-rs/actions/runs/16282439691), [PR branch with a fake change](https://github.com/smithy-lang/smithy-rs/actions/runs/16283665358)) ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 1a94d1d commit 1799955

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

buildSrc/src/main/kotlin/CodegenTestCommon.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ fun Project.registerGenerateCargoConfigTomlTask(outputDir: File) {
286286
// is completed, warnings can be prohibited in rustdoc by setting `rustdocflags` to `-D warnings`.
287287
doFirst {
288288
outputDir.resolve(".cargo").mkdirs()
289-
// TODO(MSRV1.82 follow-up): Restore `"--deny", "warnings"` once lints are fixed in the server runtime crates
290289
outputDir.resolve(".cargo/config.toml")
291290
.writeText(
292291
"""

tools/ci-build/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ ENV PATH=/opt/nodejs/bin:/opt/cargo/bin:$PATH:/usr/local/musl/bin/ \
239239
RUST_STABLE_VERSION=${rust_stable_version} \
240240
RUST_NIGHTLY_VERSION=${rust_nightly_version} \
241241
CARGO_INCREMENTAL=0 \
242-
RUSTDOCFLAGS="-D warnings" \
243-
# TODO(MSRV1.85 follow-up): Remove the allowed lints once fixed
244-
RUSTFLAGS="-D warnings -A clippy::redundant_closure -A non_local_definitions" \
245242
LANG=en_US.UTF-8 \
246243
LC_ALL=en_US.UTF-8
247244
# SMITHY_RS_DOCKER_BUILD_IMAGE indicates to build scripts that they are being built inside of the Docker build image.

tools/ci-build/build.docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ version: '3.9'
66
services:
77
smithy-rs-build:
88
image: smithy-rs-build-image:latest
9+
environment:
10+
RUSTDOCFLAGS: -D warnings
11+
# TODO(https://github.com/smithy-lang/smithy-rs/issues/4122): Remove the allowed lints once fixed in the server runtime crates
12+
RUSTFLAGS: -D warnings -A clippy::redundant_closure -A non_local_definitions
913
user: ${USER_ID}:build
1014
volumes:
1115
- type: bind

tools/ci-scripts/check-rust-runtimes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ do
3131

3232
echo -e "## ${C_YELLOW}Running 'cargo doc' on ${runtime_path}...${C_RESET}"
3333

34-
# TODO(MSRV1.82 follow-up): Restore `-Dwarnings` once lints are fixed in aws-smithy-http-server-python:
35-
# "error: unexpected `cfg` condition name: `addr_of`"
3634
RUSTDOCFLAGS="--cfg docsrs -Dwarnings" cargo +"${RUST_NIGHTLY_VERSION}" doc --no-deps --document-private-items --all-features
3735

3836
echo -e "## ${C_YELLOW}Running 'cargo minimal-versions check' on ${runtime_path}...${C_RESET}"

0 commit comments

Comments
 (0)