ci: use older version of gRPC for quickstart-production#16155
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new Dockerfile fedora-cmake-quickstart.Dockerfile to set up a Fedora 40-based build environment with various dependencies, and updates the Cloud Build triggers to use this new image. The review feedback focuses on optimizing the Dockerfile to reduce image size and build times. Key recommendations include consolidating dnf package installations, configuring ldconfig earlier in the build process so dependencies can locate libraries, enabling parallel compilation for Universal Ctags, cleaning up temporary build directories, and removing redundant commands.
| RUN echo "root:cloudcxx" | chpasswd | ||
|
|
There was a problem hiding this comment.
Configure /etc/ld.so.conf.d/local.conf and run ldconfig before building any dependencies. Since intermediate build steps (like gRPC) run ldconfig and rely on previously installed libraries in /usr/local/lib or /usr/local/lib64 (such as protobuf or abseil), having this configuration set up early ensures that those libraries are correctly cached and discoverable during the build process.
RUN echo "root:cloudcxx" | chpasswd
# Configure ldconfig to search /usr/local/lib and /usr/local/lib64 before building dependencies
RUN (echo /usr/local/lib; echo /usr/local/lib64) | tee /etc/ld.so.conf.d/local.conf && ldconfig
| RUN dnf makecache && \ | ||
| dnf install -y abi-compliance-checker autoconf automake \ | ||
| clang clang-analyzer clang-tools-extra \ | ||
| cmake diffutils findutils gcc-c++ git \ | ||
| libcurl-devel llvm make ninja-build \ | ||
| openssl-devel patch python python3 \ | ||
| python-pip tar unzip w3m wget which zip zlib-devel | ||
|
|
||
| # Install the Python modules needed to run the storage emulator | ||
| RUN dnf makecache && dnf install -y python3-devel | ||
| RUN pip3 install --upgrade pip | ||
| RUN pip3 install setuptools wheel | ||
|
|
||
| # The Cloud Pub/Sub emulator needs Java :shrug: | ||
| RUN dnf makecache && dnf install -y java-latest-openjdk | ||
|
|
||
| # This is used to improve the output in check-api builds | ||
| RUN dnf makecache && dnf install -y "dnf-command(debuginfo-install)" | ||
| RUN dnf makecache && dnf debuginfo-install -y libstdc++ | ||
|
|
||
| # These are used by the docfx tool. | ||
| RUN dnf makecache && dnf install -y pugixml-devel | ||
|
|
||
| RUN dnf install -y valgrind |
There was a problem hiding this comment.
Consolidate the multiple dnf install and dnf makecache runs into a single RUN instruction. This reduces the number of intermediate layers, avoids redundant metadata downloads, and significantly decreases the final image size. We can also append dnf clean all at the end to clean up the package manager cache. Additionally, we can include c-ares-devel and re2-devel here to avoid installing them later.
RUN dnf makecache && \
dnf install -y abi-compliance-checker autoconf automake \
clang clang-analyzer clang-tools-extra \
cmake diffutils findutils gcc-c++ git \
libcurl-devel llvm make ninja-build \
openssl-devel patch python python3 \
python-pip tar unzip w3m wget which zip zlib-devel \
python3-devel java-latest-openjdk "dnf-command(debuginfo-install)" \
pugixml-devel valgrind c-ares-devel re2-devel && \
dnf debuginfo-install -y libstdc++ && \
dnf clean all
| # Use older version of gRPC that has demonstrated to encounter the gRPC+OpenSSL | ||
| # double free issue in order to reduce flakes. | ||
| WORKDIR /var/tmp/build/grpc | ||
| RUN dnf makecache && dnf install -y c-ares-devel re2-devel |
| ./autogen.sh && \ | ||
| ./configure --prefix=/usr/local && \ | ||
| make && \ | ||
| make install && \ | ||
| cd /var/tmp && rm -fr build |
| RUN curl -fsSL https://github.com/lvc/abi-dumper/archive/16bb467cd7d343dd3a16782b151b56cf15509594.tar.gz | \ | ||
| tar -xzf - --strip-components=1 && \ | ||
| mv abi-dumper.pl /usr/local/bin/abi-dumper && \ | ||
| chmod +x /usr/local/bin/abi-dumper |
There was a problem hiding this comment.
Clean up the /var/tmp/build directory after installing abi-dumper to avoid leaving leftover files that can pollute subsequent builds in the same directory and bloat the image size.
RUN curl -fsSL https://github.com/lvc/abi-dumper/archive/16bb467cd7d343dd3a16782b151b56cf15509594.tar.gz | \
tar -xzf - --strip-components=1 && \
mv abi-dumper.pl /usr/local/bin/abi-dumper && \
chmod +x /usr/local/bin/abi-dumper && \
cd /var/tmp && rm -fr build
| RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.15.0/sccache-v0.15.0-x86_64-unknown-linux-musl.tar.gz | \ | ||
| tar -zxf - --strip-components=1 && \ | ||
| mkdir -p /usr/local/bin && \ | ||
| mv sccache /usr/local/bin/sccache && \ | ||
| chmod +x /usr/local/bin/sccache |
There was a problem hiding this comment.
Clean up the /var/tmp/sccache directory after installing sccache to reduce the final Docker image size.
RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.15.0/sccache-v0.15.0-x86_64-unknown-linux-musl.tar.gz | \
tar -zxf - --strip-components=1 && \
mkdir -p /usr/local/bin && \
mv sccache /usr/local/bin/sccache && \
chmod +x /usr/local/bin/sccache && \
cd /var/tmp && rm -fr sccache
| RUN (echo /usr/local/lib; echo /usr/local/lib64) | tee /etc/ld.so.conf.d/local.conf | ||
| RUN ldconfig /usr/local/lib* |
| COPY . /var/tmp/ci | ||
| WORKDIR /var/tmp/downloads | ||
| # The Google Cloud CLI requires Python <= 3.10, Fedora defaults to 3.12. | ||
| RUN dnf makecache && dnf install -y python3.10 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16155 +/- ##
==========================================
- Coverage 92.20% 92.20% -0.01%
==========================================
Files 2264 2264
Lines 209084 209084
==========================================
- Hits 192791 192786 -5
- Misses 16293 16298 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There's an outstanding issue on program exit with certain versions of gRPC + OpenSSL that results in a double free or other alloc error. Until there is a fix, use an older version of gRPC where the issue appears less often.