Fix Podman container to run as non-root user
Some checks failed
Build libostree Backport / Build libostree Backport (push) Successful in 11m37s
Build ostree Backports / Build ostree Backport for noble (push) Failing after 3m25s

- Add sudo package installation in containers
- Create backport-user account in containers
- Set proper ownership of workspace directory
- Configure sudo access for backport-user
- Run ostree-backport.sh as non-root user
- This fixes the 'should not be run as root' safety check
- Maintains all safety features while allowing proper execution
This commit is contained in:
robojerk 2025-08-05 10:30:21 -07:00
parent fc05ffcbb9
commit c6b363974e
3 changed files with 12 additions and 4 deletions

View file

@ -69,14 +69,18 @@ run_in_podman() {
bash -c "
echo '=== Setting up container environment ==='
apt update -y
apt install -y git curl wget
apt install -y git curl wget sudo
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* /workspace/
cp -r /tmp/libostree-dev/.* /workspace/ 2>/dev/null || true
chmod +x /workspace/*.sh
echo '=== Container ready, running backport ==='
cd /workspace
./ostree-backport.sh noble
# Create a non-root user for running the script
useradd -m -s /bin/bash backport-user
chown -R backport-user:backport-user /workspace
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
su - backport-user -c 'cd /workspace && ./ostree-backport.sh noble'
"
}

View file

@ -69,14 +69,18 @@ run_in_podman() {
bash -c "
echo '=== Setting up container environment ==='
apt update -y
apt install -y git curl wget
apt install -y git curl wget sudo
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* /workspace/
cp -r /tmp/libostree-dev/.* /workspace/ 2>/dev/null || true
chmod +x /workspace/*.sh
echo '=== Container ready, running backport ==='
cd /workspace
./ostree-backport.sh trixie
# Create a non-root user for running the script
useradd -m -s /bin/bash backport-user
chown -R backport-user:backport-user /workspace
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
su - backport-user -c 'cd /workspace && ./ostree-backport.sh trixie'
"
}

0
libostree-dev_noble_backport.sh Normal file → Executable file
View file