Fix CI/CD root user error in deployment scripts
- 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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user