Run Renovate via container instead of npm install
Some checks failed
CICD / Build and Publish CICD Base Image (push) Successful in 37s
CICD / Build and Push CICD Image (push) Successful in 26m6s
CICD / Build CICD Image Failure Postmortem (push) Has been skipped
CICD / Pre-commit Checks (push) Successful in 2m54s
CICD / Frontend Tests (push) Successful in 33s
CICD / Backend Doctests (push) Successful in 39s
CICD / Backend Tests (push) Successful in 23m40s
CICD / Source Lanes Failure Postmortem (push) Has been skipped
CICD / CICD Tests Complete (push) Successful in 7s
CICD / Build Backend Base Image (push) Successful in 2m9s
CICD / Build Integration Tester Image (push) Successful in 1m16s
CICD / Build Frontend Base Image (push) Successful in 8m54s
CICD / Build and Publish Runtime Images (Legacy Disabled) (push) Has been skipped
CICD / Build Backend Main Image (push) Successful in 6m17s
CICD / Build Frontend Main Image (push) Successful in 6m3s
CICD / Build E2E Tester Image (push) Successful in 17m43s
CICD / Runtime Images Failure Postmortem (push) Has been skipped
CICD / Production Images Complete (push) Successful in 4s
CICD / Runtime Black-Box Integration Tests (push) Successful in 1m39s
CICD / Integration Tests Failure Postmortem (push) Has been skipped
CICD / End-to-End Tests (push) Failing after 5m40s
CICD / E2E Tests Failure Postmortem (push) Successful in 11s

This commit is contained in:
copilotcoder
2026-07-08 17:19:19 -04:00
parent 5d37379aac
commit 548232afe2

View File

@@ -20,190 +20,44 @@ jobs:
timeout-minutes: 90
steps:
- name: Setup Node.js for Renovate
- name: Prepare Renovate container image
env:
RENOVATE_IMAGE: ghcr.io/renovatebot/renovate:41
run: |
echo "=== Setting up Node.js 24 for Renovate ==="
set -euo pipefail
# Check existing Node.js
if command -v node &> /dev/null; then
echo "Current Node.js version: $(node --version)"
fi
if command -v npm &> /dev/null; then
echo "Current npm version: $(npm --version)"
fi
retry_cmd() {
attempts="${1:-3}"
backoff="${2:-10}"
shift 2
# Aggressive cleanup of all Node.js/npm installations
echo "Performing complete Node.js cleanup..."
# Stop any Node.js processes
sudo pkill -f node || true
# Remove all package-managed Node.js installations
sudo apt-get remove -y --purge nodejs npm node || true
sudo apt-get autoremove -y --purge || true
# Remove all manual installations and caches
sudo rm -rf /usr/local/bin/node* /usr/local/bin/npm* || true
sudo rm -rf /usr/local/lib/node* /usr/local/include/node* || true
sudo rm -rf ~/.npm ~/.nvm ~/.node* || true
sudo rm -rf /root/.npm /root/.nvm /root/.node* || true
sudo rm -rf /usr/share/nodejs || true
sudo rm -rf /etc/apt/sources.list.d/nodesource.list* || true
# Clear npm environment variables that might conflict
unset npm_config_prefix npm_config_cache npm_config_globalconfig npm_config_init_module || true
echo "✓ Cleanup completed"
# Install Node.js 24 from NodeSource with error handling
echo "Installing Node.js 24..."
# Remove any existing NodeSource repository
sudo rm -f /etc/apt/sources.list.d/nodesource.list || true
# Add NodeSource repository
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
# Install with DEBIAN_FRONTEND to avoid interactive prompts
echo "Installing Node.js package..."
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
# Verify and fix installation
echo "=== Verifying Node.js Installation ==="
# Check Node.js
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
echo "✓ Node.js installed: $NODE_VERSION"
else
echo "❌ Node.js installation failed"
exit 1
fi
# Check npm and fix if needed
if command -v npm &> /dev/null && npm --version &> /dev/null; then
NPM_VERSION=$(npm --version)
echo "✓ npm working: $NPM_VERSION"
else
echo "⚠️ npm not working properly, reinstalling..."
# Method 1: Try to fix npm with the bundled version
if [ -f "/usr/bin/node" ] && [ -f "/usr/lib/node_modules/npm/bin/npm-cli.js" ]; then
echo "Using bundled npm..."
sudo ln -sf /usr/lib/node_modules/npm/bin/npm-cli.js /usr/bin/npm || true
sudo chmod +x /usr/bin/npm || true
fi
# Method 2: If that doesn't work, reinstall npm manually
if ! npm --version &> /dev/null; then
echo "Manual npm installation..."
curl -L https://www.npmjs.com/install.sh | sudo sh
fi
# Method 3: Last resort - use npx to bootstrap npm
if ! npm --version &> /dev/null; then
echo "Using node to run npm directly..."
# Create npm wrapper script
echo '#!/bin/bash' | sudo tee /usr/bin/npm > /dev/null
echo 'exec /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js "$@"' | sudo tee -a /usr/bin/npm > /dev/null
sudo chmod +x /usr/bin/npm
fi
# Final verification
if npm --version &> /dev/null; then
echo "✓ npm recovered successfully: $(npm --version)"
else
echo "❌ npm recovery failed"
exit 1
fi
fi
# Test npm basic functionality
echo "Testing npm functionality..."
if npm config get registry &> /dev/null; then
echo "✓ npm configuration accessible"
else
echo "⚠️ npm configuration issues, but continuing..."
fi
# Check version compatibility for Renovate
NODE_VERSION=$(node --version | cut -d'v' -f2)
echo "=== Version Compatibility Check ==="
echo "Node.js version: $NODE_VERSION"
if [[ $(echo "$NODE_VERSION 24.10.0" | awk '{print ($1 >= $2)}') == 1 ]]; then
echo "✅ Node.js version $NODE_VERSION meets Renovate latest requirements"
echo "RENOVATE_VERSION=latest" >> $GITHUB_ENV
else
echo "⚠️ Node.js version $NODE_VERSION - will use compatible Renovate version"
echo "RENOVATE_VERSION=40.3.2" >> $GITHUB_ENV
fi
- name: Install Renovate
run: |
echo "=== Installing Renovate ==="
# Set npm configuration for memory efficiency
npm config set fund false
npm config set audit false
npm config set progress false
npm config set maxsockets 3
npm config set fetch-retry-mintimeout 2000
npm config set fetch-retry-maxtimeout 10000
# Use the version determined in previous step
echo "Installing Renovate version: $RENOVATE_VERSION"
# Check available memory
echo "Memory info:"
free -h || echo "free command not available"
# Install with retry logic and memory-efficient options
for i in 1 2 3; do
echo "Renovate installation attempt $i/3..."
# Clear npm cache and temp files
npm cache clean --force || true
rm -rf /tmp/npm-* || true
# Use memory-efficient installation with longer timeout
if NODE_OPTIONS="--max-old-space-size=2048" timeout 600 npm install -g "renovate@$RENOVATE_VERSION" \
--no-audit \
--no-fund \
--no-optional \
--production \
--maxsockets=3 \
--fetch-timeout=30000; then
echo "✓ Renovate installation successful on attempt $i"
break
else
exit_code=$?
echo "⚠️ Renovate installation attempt $i failed (exit code: $exit_code)"
# Check if it was killed due to memory
if [ $exit_code -eq 137 ] || [ $exit_code -eq 143 ]; then
echo " Process was killed (likely out of memory)"
attempt=1
while [ "${attempt}" -le "${attempts}" ]; do
if "$@"; then
return 0
fi
if [ $i -eq 3 ]; then
echo "❌ All Renovate installation attempts failed"
echo "Debugging information:"
echo "Node.js version: $(node --version)"
echo "npm version: $(npm --version)"
echo "Memory status:"
free -h || echo "Memory info unavailable"
echo "npm config:"
npm config list || echo "npm config failed"
exit 1
if [ "${attempt}" -lt "${attempts}" ]; then
sleep_seconds=$((backoff * attempt))
echo "Command failed (attempt ${attempt}/${attempts}): $*"
echo "Retrying in ${sleep_seconds}s"
sleep "${sleep_seconds}"
fi
echo "Waiting 30 seconds before retry..."
sleep 30
fi
done
attempt=$((attempt + 1))
done
# Verify Renovate installation
echo "✓ Renovate version: $(renovate --version)"
echo "✓ Renovate location: $(which renovate)"
echo "Command failed after ${attempts} attempts: $*"
return 1
}
echo "=== Preparing Renovate container ==="
echo "Using Renovate image: ${RENOVATE_IMAGE}"
free -h || true
retry_cmd 3 15 docker pull "${RENOVATE_IMAGE}"
docker run --rm "${RENOVATE_IMAGE}" --version
echo "RENOVATE_IMAGE=${RENOVATE_IMAGE}" >> "$GITHUB_ENV"
- name: Configure Renovate for Gitea
run: |
@@ -330,7 +184,20 @@ jobs:
unset RENOVATE_DRY_RUN
fi
renovate --platform "${RENOVATE_PLATFORM}" --endpoint "${RENOVATE_ENDPOINT}" DarkHelm.org/plex-playlist
docker run --rm \
-v "$PWD:/work" \
-w /work \
-e LOG_LEVEL \
-e NODE_TLS_REJECT_UNAUTHORIZED \
-e RENOVATE_TOKEN \
-e RENOVATE_PLATFORM \
-e RENOVATE_ENDPOINT \
-e RENOVATE_DRY_RUN \
-e RENOVATE_CONFIG_FILE=/work/renovate-config.js \
"${RENOVATE_IMAGE}" \
--platform "${RENOVATE_PLATFORM}" \
--endpoint "${RENOVATE_ENDPOINT}" \
DarkHelm.org/plex-playlist | tee /tmp/renovate.log
echo "✓ Renovate execution completed"