fix(ci): fix python syntax in arbitrary uid test and add ca-certificates in trixie images

This commit is contained in:
Revant Nandgaonkar 2026-09-19 15:07:41 +05:30
parent 11287d3199
commit b810e91142
4 changed files with 18 additions and 11 deletions

View File

@ -11,6 +11,7 @@ ARG WKHTMLTOPDF_DISTRO=bookworm
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
# For frappe framework
ca-certificates \
git \
mariadb-client \
postgresql-client \

View File

@ -18,6 +18,7 @@ ENV PATH=${NVM_DIR}/current/bin/:${PATH}
RUN useradd -u 1000 -g 0 -d /home/frappe -ms /bin/bash frappe \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
git \
vim \

View File

@ -14,6 +14,7 @@ ENV PATH=${NVM_DIR}/current/bin/:${PATH}
RUN useradd -u 1000 -g 0 -d /home/frappe -ms /bin/bash frappe \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
git \
vim \

View File

@ -186,17 +186,21 @@ def test_arbitrary_uid_execution(compose: Compose):
- Writability of required paths (/home/frappe, /tmp, sites directory)
"""
check_script = (
"import os, pwd, tempfile; "
"uid = os.getuid(); "
"gid = os.getgid(); "
"user = pwd.getpwuid(uid).pw_name; "
"assert gid == 0, f'Expected GID 0, got {gid}'; "
"old_umask = os.umask(0); "
"os.umask(old_umask); "
"assert old_umask == 0o002, f'Expected umask 0002, got {oct(old_umask)}'; "
"with tempfile.NamedTemporaryFile(dir='/home/frappe') as f: f.write(b'ok'); "
"with tempfile.NamedTemporaryFile(dir='/home/frappe/frappe-bench/sites') as f: f.write(b'ok'); "
"print(f'VERIFIED:{user}:{uid}:{gid}')"
"import os\n"
"import pwd\n"
"import tempfile\n"
"uid = os.getuid()\n"
"gid = os.getgid()\n"
"user = pwd.getpwuid(uid).pw_name\n"
"assert gid == 0, f'Expected GID 0, got {gid}'\n"
"old_umask = os.umask(0)\n"
"os.umask(old_umask)\n"
"assert old_umask == 0o002, f'Expected umask 0002, got {oct(old_umask)}'\n"
"with tempfile.NamedTemporaryFile(dir='/home/frappe') as f:\n"
" f.write(b'ok')\n"
"with tempfile.NamedTemporaryFile(dir='/home/frappe/frappe-bench/sites') as f:\n"
" f.write(b'ok')\n"
"print(f'VERIFIED:{user}:{uid}:{gid}')\n"
)
compose(