Skip to content

Commit b86a22a

Browse files
[Github] Default to non-root user in linux CI container (#119987)
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.
1 parent 3769fcb commit b86a22a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/build-ci-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Test Container
6161
run: |
6262
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
63-
podman run --rm -it $image /usr/bin/bash -x -c 'printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
63+
podman run --rm -it $image /usr/bin/bash -x -c 'cd $HOME && printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
6464
done
6565
6666
push-ci-container:

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,10 @@ RUN apt-get update && \
6868

6969
ENV LLVM_SYSROOT=$LLVM_SYSROOT
7070
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
71+
72+
# Create a new user to avoid test failures related to a lack of expected
73+
# permissions issues in some tests. Set the user id to 1001 as that is the
74+
# user id that Github Actions uses to perform the checkout action.
75+
RUN useradd gha -u 1001 -m -s /bin/bash
76+
USER gha
77+

0 commit comments

Comments
 (0)