[llvm] [Github] Add sudo to CI container (PR #122036)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 7 17:35:26 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-github-workflow
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This patch adds sudo to the CI container and also adds the gha user as a member of the sudo group along with making any member of the sudo group able to run commands as root without a password. This is primarily intended to enable installing new software through apt-get without having to rebuild the container.
---
Full diff: https://github.com/llvm/llvm-project/pull/122036.diff
1 Files Affected:
- (modified) .github/workflows/containers/github-action-ci/Dockerfile (+7)
``````````diff
diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile
index 58355d261c43c9..d4e6cdcd70423a 100644
--- a/.github/workflows/containers/github-action-ci/Dockerfile
+++ b/.github/workflows/containers/github-action-ci/Dockerfile
@@ -57,6 +57,7 @@ RUN apt-get update && \
nodejs \
perl-modules \
python3-psutil \
+ sudo \
# These are needed by the premerge pipeline. Pip is used to install
# dependent python packages and ccache is used for build caching. File and
@@ -73,5 +74,11 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
# permissions issues in some tests. Set the user id to 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
+
+# Also add the user to passwordless sudoers so that we can install software
+# later on without having to rebuild the container.
+RUN adduser gha sudo
+RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
USER gha
``````````
</details>
https://github.com/llvm/llvm-project/pull/122036
More information about the llvm-commits
mailing list