refactor: clean up rustflags and build args (#8047)

- move `tokio_unstable` to cargo config, so all we can use it within
   our code (e.g. for #7982)
- disable incremental builds for prod docker builds. this was tried
  before but got lost at some point because build params weren't passed
  to docker correclty
- fix `CARGO_NET_GIT_FETCH_WITH_CLI` for docker builds (env wasn't
  passed through)
pull/24376/head
Marco Neumann 2023-06-22 11:58:46 +02:00 committed by GitHub
parent 4e18a5f9e8
commit 4d1c6f805c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,12 @@
[build]
# enable tokio-console and some other goodies
rustflags = [
"--cfg", "tokio_unstable",
]
rustdocflags = [
"--cfg", "tokio_unstable",
]
# sparse protocol opt-in
# See https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html#cargos-sparse-protocol
[registries.crates-io]

View File

@ -301,10 +301,9 @@ jobs:
environment:
# Disable incremental compilation to avoid overhead. We are not preserving these files anyway.
CARGO_INCREMENTAL: "0"
# - Disable full debug symbol generation to speed up CI build
# "1" means line tables only, which is useful for panic tracebacks.
# - Enable tokio-console
RUSTFLAGS: "-C debuginfo=1 --cfg tokio_unstable"
# Disable full debug symbol generation to speed up CI build
# "1" means line tables only, which is useful for panic tracebacks.
RUSTFLAGS: "-C debuginfo=1"
# https://github.com/rust-lang/cargo/issues/10280
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
# The `2xlarge` resource class that we use has 32GB RAM but also 16 CPUs. This means we have 2GB RAM per core on
@ -381,13 +380,6 @@ jobs:
machine:
image: ubuntu-2004:2022.04.2
resource_class: 2xlarge # CPU bound, so make it fast
environment:
# Disable incremental compilation to avoid overhead. We are not preserving these files anyway.
CARGO_INCREMENTAL: "0"
# Enable tokio-console
RUSTFLAGS: "--cfg tokio_unstable"
# https://github.com/rust-lang/cargo/issues/10280
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- checkout
- run:
@ -398,17 +390,19 @@ jobs:
RUST_VERSION="$(sed -E -ne 's/channel = "(.*)"/\1/p' rust-toolchain.toml)"
docker buildx build \
--build-arg CARGO_INCREMENTAL="no" \
--build-arg CARGO_NET_GIT_FETCH_WITH_CLI="true" \
--build-arg FEATURES="aws,gcp,azure,jemalloc_replacing_malloc,tokio_console,pprof" \
--build-arg RUST_VERSION="$RUST_VERSION" \
--build-arg RUSTFLAGS="$RUSTFLAGS" \
--progress plain \
--tag quay.io/influxdb/iox:"$COMMIT_SHA" \
.
docker buildx build \
--build-arg CARGO_INCREMENTAL="no" \
--build-arg CARGO_NET_GIT_FETCH_WITH_CLI="true" \
--build-arg FEATURES="" \
--build-arg PACKAGE="iox_data_generator" \
--build-arg RUST_VERSION="$RUST_VERSION" \
--build-arg RUSTFLAGS="$RUSTFLAGS" \
--progress plain \
--tag quay.io/influxdb/iox_data_generator:"$COMMIT_SHA" \
.

View File

@ -14,11 +14,13 @@ COPY . /influxdb_iox
WORKDIR /influxdb_iox
ARG CARGO_INCREMENTAL=yes
ARG CARGO_NET_GIT_FETCH_WITH_CLI=false
ARG PROFILE=release
ARG FEATURES=aws,gcp,azure,jemalloc_replacing_malloc
ARG PACKAGE=influxdb_iox
ARG RUSTFLAGS=""
ENV CARGO_INCREMENTAL=$CARGO_INCREMENTAL \
CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_NET_GIT_FETCH_WITH_CLI \
PROFILE=$PROFILE \
FEATURES=$FEATURES \
PACKAGE=$PACKAGE \