Skip to content

Commit 91ab10e

Browse files
[Github] Add sudo to CI container (#122036)
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.
1 parent 5ae44bf commit 91ab10e

File tree

1 file changed

+7
-0
lines changed
  • .github/workflows/containers/github-action-ci

1 file changed

+7
-0
lines changed

Diff for: .github/workflows/containers/github-action-ci/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && \
5757
nodejs \
5858
perl-modules \
5959
python3-psutil \
60+
sudo \
6061

6162
# These are needed by the premerge pipeline. Pip is used to install
6263
# dependent python packages and ccache is used for build caching. File and
@@ -73,5 +74,11 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
7374
# permissions issues in some tests. Set the user id to 1001 as that is the
7475
# user id that Github Actions uses to perform the checkout action.
7576
RUN useradd gha -u 1001 -m -s /bin/bash
77+
78+
# Also add the user to passwordless sudoers so that we can install software
79+
# later on without having to rebuild the container.
80+
RUN adduser gha sudo
81+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
82+
7683
USER gha
7784

0 commit comments

Comments
 (0)