Fix Podman permission issues and improve package handling - Avoid changing ownership of host files in containers - Only change ownership of script files needed for execution - Copy built packages to builds/ directory instead of workspace root - Add builds/ and package files to .gitignore - This prevents permission issues and keeps built packages organized
This commit is contained in:
parent
95097ad46a
commit
6fe3939923
3 changed files with 32 additions and 6 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
builds/
|
||||||
|
*.deb
|
||||||
|
*.dsc
|
||||||
|
*.tar.*
|
||||||
|
|
@ -62,7 +62,6 @@ run_in_podman() {
|
||||||
--name "$CONTAINER_NAME" \
|
--name "$CONTAINER_NAME" \
|
||||||
--privileged \
|
--privileged \
|
||||||
--security-opt label=disable \
|
--security-opt label=disable \
|
||||||
-v /opt:/opt:shared \
|
|
||||||
-v "$(pwd):/workspace:Z" \
|
-v "$(pwd):/workspace:Z" \
|
||||||
-w /workspace \
|
-w /workspace \
|
||||||
ubuntu:24.04 \
|
ubuntu:24.04 \
|
||||||
|
|
@ -78,9 +77,21 @@ run_in_podman() {
|
||||||
cd /workspace
|
cd /workspace
|
||||||
# Create a non-root user for running the script
|
# Create a non-root user for running the script
|
||||||
useradd -m -s /bin/bash backport-user
|
useradd -m -s /bin/bash backport-user
|
||||||
chown -R backport-user:backport-user /workspace
|
# Don't change ownership of host files - only workspace content
|
||||||
|
chown -R backport-user:backport-user /workspace/*.sh
|
||||||
|
chown -R backport-user:backport-user /workspace/ostree-backport.sh
|
||||||
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
su - backport-user -c 'cd /workspace && ./ostree-backport.sh noble'
|
# Create build directory inside container
|
||||||
|
mkdir -p /home/backport-user/build
|
||||||
|
chown -R backport-user:backport-user /home/backport-user
|
||||||
|
su - backport-user -c 'cd /workspace && BACKPORT_DIR=/home/backport-user/build/ostree-backport-noble ./ostree-backport.sh noble'
|
||||||
|
# Copy built packages to host builds directory
|
||||||
|
echo '=== Copying built packages to host builds/ directory ==='
|
||||||
|
mkdir -p /workspace/builds
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-noble/*.deb /workspace/builds/ 2>/dev/null || echo 'No .deb files found'
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-noble/*.dsc /workspace/builds/ 2>/dev/null || echo 'No .dsc files found'
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-noble/*.tar.* /workspace/builds/ 2>/dev/null || echo 'No source tarballs found'
|
||||||
|
echo '=== Build complete. Check builds/ directory for packages ==='
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
backport-trixie.sh
Executable file → Normal file
17
backport-trixie.sh
Executable file → Normal file
|
|
@ -62,7 +62,6 @@ run_in_podman() {
|
||||||
--name "$CONTAINER_NAME" \
|
--name "$CONTAINER_NAME" \
|
||||||
--privileged \
|
--privileged \
|
||||||
--security-opt label=disable \
|
--security-opt label=disable \
|
||||||
-v /opt:/opt:shared \
|
|
||||||
-v "$(pwd):/workspace:Z" \
|
-v "$(pwd):/workspace:Z" \
|
||||||
-w /workspace \
|
-w /workspace \
|
||||||
debian:testing \
|
debian:testing \
|
||||||
|
|
@ -78,9 +77,21 @@ run_in_podman() {
|
||||||
cd /workspace
|
cd /workspace
|
||||||
# Create a non-root user for running the script
|
# Create a non-root user for running the script
|
||||||
useradd -m -s /bin/bash backport-user
|
useradd -m -s /bin/bash backport-user
|
||||||
chown -R backport-user:backport-user /workspace
|
# Don't change ownership of host files - only workspace content
|
||||||
|
chown -R backport-user:backport-user /workspace/*.sh
|
||||||
|
chown -R backport-user:backport-user /workspace/ostree-backport.sh
|
||||||
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
echo 'backport-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
su - backport-user -c 'cd /workspace && ./ostree-backport.sh trixie'
|
# Create build directory inside container
|
||||||
|
mkdir -p /home/backport-user/build
|
||||||
|
chown -R backport-user:backport-user /home/backport-user
|
||||||
|
su - backport-user -c 'cd /workspace && BACKPORT_DIR=/home/backport-user/build/ostree-backport-trixie ./ostree-backport.sh trixie'
|
||||||
|
# Copy built packages to host builds directory
|
||||||
|
echo '=== Copying built packages to host builds/ directory ==='
|
||||||
|
mkdir -p /workspace/builds
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-trixie/*.deb /workspace/builds/ 2>/dev/null || echo 'No .deb files found'
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-trixie/*.dsc /workspace/builds/ 2>/dev/null || echo 'No .dsc files found'
|
||||||
|
cp -r /home/backport-user/build/ostree-backport-trixie/*.tar.* /workspace/builds/ 2>/dev/null || echo 'No source tarballs found'
|
||||||
|
echo '=== Build complete. Check builds/ directory for packages ==='
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue