Fix CI/CD root user error in deployment scripts
Some checks failed
CI/CD Pipeline (Reliable & Simple) / production (push) Failing after 9m5s
CI/CD Pipeline (Simple & Reliable) / production (push) Failing after 6m29s

- Modify root checks to allow running as root in CI environments
- Add conditional check: only prevent root when not in CI (CI env var not set)
- Updated scripts:
  - scripts/gitea-deploy.sh
  - scripts/gitea-deploy-simple.sh
  - scripts/deploy.sh
  - scripts/auto-deploy.sh
  - scripts/setup-gitea-runner.sh

This fixes the 'This script should not be run as root' error in Gitea Actions
where containers run as root by default.
This commit is contained in:
2025-10-15 15:10:10 +02:00
parent 8d65e2d7c3
commit 04522d3093
5 changed files with 15 additions and 15 deletions

View File

@@ -37,9 +37,9 @@ warning() {
echo -e "${YELLOW}[WARNING]${NC} $1" | tee -a "$LOG_FILE"
}
# Check if running as root
if [[ $EUID -eq 0 ]]; then
error "This script should not be run as root"
# Check if running as root (skip in CI environments)
if [[ $EUID -eq 0 ]] && [[ -z "$CI" ]]; then
error "This script should not be run as root (use CI=true to override)"
exit 1
fi