-
Couldn't load subscription status.
- Fork 15k
[Github][CI] Add default gha user for tooling containers #164294
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-clang-tidy @llvm/pr-subscribers-github-workflow Author: Baranov Victor (vbvictor) ChangesThis should probably solve llvm-project/.github/workflows/pr-code-format.yml Lines 28 to 34 in c0073a9
Full diff: https://github.com/llvm/llvm-project/pull/164294.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 9d2aaf6bbd48a..4135ae839cd47 100644
--- a/.github/workflows/containers/github-action-ci-tooling/Dockerfile
+++ b/.github/workflows/containers/github-action-ci-tooling/Dockerfile
@@ -37,6 +37,11 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
+# Create a new user with id 1001 as that is the user id that
+# Github Actions uses to perform the checkout action.
+RUN useradd gha -u 1001 -m -s /bin/bash
+RUN adduser gha sudo
+RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
FROM base AS ci-container-code-format
ARG LLVM_VERSION
@@ -51,6 +56,8 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
COPY llvm/utils/git/requirements_formatting.txt requirements_formatting.txt
RUN pip install -r requirements_formatting.txt --break-system-packages && \
rm requirements_formatting.txt
+USER gha
+WORKDIR /home/gha
FROM base AS ci-container-code-lint
@@ -80,3 +87,5 @@ RUN apt-get update && \
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
RUN pip install -r requirements_linting.txt --break-system-packages && \
rm requirements_linting.txt
+USER gha
+WORKDIR /home/gha
|
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.
Instead of "probably", can we actually test this? Shouldn't be difficult to push this to GHCR and run a test job with workflow modifications.
Hmm, I didn't know I can push locally build images to GitHub. I'll check |
|
✅ With the latest revision this PR passed the Python code formatter. |
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
|
Thank you for suggestion, I build container from this branch locally and tested - it worked. Will delete it from Github once merged |
Not sure you need to do that. It's just another tag among all the others in there. |
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.
LGTM. Thanks for fixing this up.
This should probably solve
llvm-project/.github/workflows/pr-code-format.yml
Lines 28 to 34 in c0073a9