Skip to content
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

[Github] Default to non-root user in linux CI container #119987

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

boomanaiden154
Copy link
Contributor

This patch sets the default user in the linux CI container to a non-root user, which enables properly testing a couple of features, particularly in libcxx.

This patch sets the default user in the linux CI container to a non-root user,
which enables properly testing a couple of features, particularly in
libcxx.
@boomanaiden154 boomanaiden154 marked this pull request as ready for review December 14, 2024 22:32
@llvmbot
Copy link
Member

llvmbot commented Dec 14, 2024

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

This patch sets the default user in the linux CI container to a non-root user, which enables properly testing a couple of features, particularly in libcxx.


Full diff: https://github.com/llvm/llvm-project/pull/119987.diff

1 Files Affected:

  • (modified) .github/workflows/containers/github-action-ci/Dockerfile (+7)
diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile
index da11803cad1042..0e560f6bfc5fff 100644
--- a/.github/workflows/containers/github-action-ci/Dockerfile
+++ b/.github/workflows/containers/github-action-ci/Dockerfile
@@ -60,3 +60,10 @@ RUN apt-get update && \
 
 ENV LLVM_SYSROOT=$LLVM_SYSROOT
 ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
+
+# Create a new user to avoid test failures related to a lack of expected
+# 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
+USER gha
+

Copy link
Collaborator

@tstellar tstellar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine with me. The only downside is that we then can't install new packages in the container from a Workflow. We could fix this by giving the user sudo acess, though.

@boomanaiden154 boomanaiden154 merged commit b86a22a into llvm:main Dec 16, 2024
8 checks passed
@boomanaiden154 boomanaiden154 deleted the ci-container-non-root branch December 16, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants