-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[GitHub][CI] Add missing dependencies to code-lint container #163873
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
Conversation
@llvm/pr-subscribers-github-workflow Author: Baranov Victor (vbvictor) ChangesFull diff: https://github.com/llvm/llvm-project/pull/163873.diff 1 Files Affected:
diff --git a/.github/workflows/containers/github-action-ci-tooling/Dockerfile b/.github/workflows/containers/github-action-ci-tooling/Dockerfile
index 7d64562876628..5e13455d70123 100644
--- a/.github/workflows/containers/github-action-ci-tooling/Dockerfile
+++ b/.github/workflows/containers/github-action-ci-tooling/Dockerfile
@@ -9,6 +9,8 @@ RUN apt-get update && \
mkdir -p /llvm-extract && \
tar -xvJf llvm.tar.xz -C /llvm-extract \
# Only unpack these tools to save space on Github runner.
+ LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \
+ LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
@@ -51,11 +53,26 @@ RUN pip install -r requirements_formatting.txt --break-system-packages && \
FROM base AS ci-container-code-lint
ARG LLVM_VERSION
-COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
+COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
+ /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \
+ ${LLVM_SYSROOT}/bin/
+COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \
+ ${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION%%.*}/include
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
+# Make symlinks as in LLVM tar.xz package
+RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION%%.*} ${LLVM_SYSROOT}/bin/clang && \
+ ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
+
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ cmake \
+ ninja-build && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
# Install dependencies for 'pr-code-lint.yml' job
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
RUN pip install -r requirements_linting.txt --break-system-packages && \
|
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION%%.*} \ | ||
LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION%%.*}/include \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm installing clang
"manually" together with built-in libs that are needed for clang-tidy
invocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested that you can run clang-tidy
in the container with these changes?
Yes, I've checked that I can configure,build,run clang-tidy-diff.py inside container |
I can't reproduce podman build error locally
So I use separate ARG variable for major LLVM version |
@@ -1,14 +1,18 @@ | |||
ARG LLVM_VERSION=21.1.0 | |||
ARG LLVM_VERSION_MAJOR=21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we put a little bit more effort into trying to consolidate these. There's almost certainly a way to get it working.
Is the local/Github difference maybe related to podman versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is supported in docker/buildkit stack but I couldn't find that it is supported in podman/buildah stack. Locally I have Buildah 1.39 and in CI it's 1.33. I checked https://buildah.io/releases/ but nothing mentioned "variable expansions" in release notes from 1.33 to 1.39, so I have generally no idea how it works locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I found openshift/imagebuilder@88c69f9 (available in v1.2.12 or more) which adds support for %%
syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://buildah.io/releases/#changes-for-v1370 bumped imagebuilder version to v1.2.14 which supports %%
and other shell syntax. So we essentially need to have Buildah 1.37 instead of 1.33 in CI (Ubuntu 24.04).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think we can use LLVM_VERSION_MAJOR
and leave a TODO for Ubuntu-26.04
runners, which should have higher version of Buildah
(Ubuntu-25.04
has 1.39).
Another option is to move to docker buildx
but I don't think we want it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. I'm fine leaving a TODO for ~6 months given we have an understanding of what the issue is, which we do now. Nice investigation.
9ba0e5d
to
4dd94be
Compare
4dd94be
to
27c773e
Compare
No description provided.