Files
plex-playlist/scripts/validate-renovate.sh
Cliff Hill 4454e9aef5
Some checks failed
Tests / Build and Push CICD Base Image (push) Successful in 1m7s
Tests / Build and Push CICD Complete Image (push) Successful in 34m29s
Tests / YAML Syntax Check (push) Successful in 46s
Tests / Mixed Line Ending Check (push) Successful in 35s
Tests / TOML Formatting Check (push) Successful in 42s
Tests / Ruff Linting (push) Successful in 36s
Tests / Ruff Format Check (push) Successful in 36s
Tests / Pyright Type Check (push) Successful in 1m2s
Tests / Darglint Docstring Check (push) Successful in 48s
Tests / No Docstring Types Check (push) Successful in 31s
Tests / ESLint Check (push) Successful in 1m1s
Tests / Prettier Format Check (push) Successful in 44s
Tests / TypeScript Type Check (push) Successful in 1m18s
Tests / TSDoc Lint Check (push) Successful in 1m3s
Tests / Backend Tests (push) Successful in 49s
Tests / Frontend Tests (push) Successful in 1m39s
Tests / Backend Doctests (push) Successful in 35s
Tests / End-to-End Tests (push) Successful in 7m58s
Tests / Trailing Whitespace Check (push) Successful in 30m11s
Tests / Integration Tests (push) Failing after 22m6s
Tests / TOML Syntax Check (push) Failing after 38m33s
Tests / End of File Check (push) Successful in 41m46s
Adding renovate stuff.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
2025-11-04 12:40:53 -05:00

155 lines
4.8 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Renovate Configuration Validator
# This script validates the renovate.json configuration and checks for common issues
set -e
echo "🔍 Renovate Configuration Validator"
echo "=================================="
# Check if renovate.json exists
if [ ! -f "renovate.json" ]; then
echo "❌ renovate.json not found in current directory"
exit 1
fi
echo "✓ Found renovate.json"
# Check if Node.js is available
if ! command -v node &> /dev/null; then
echo "⚠️ Node.js not found, installing..."
# For Ubuntu/Debian systems
if command -v apt-get &> /dev/null; then
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
else
echo "❌ Please install Node.js 18+ to validate configuration"
exit 1
fi
fi
# Install renovate CLI if not present
if ! command -v renovate &> /dev/null; then
echo "📦 Installing Renovate CLI..."
# Check Node.js version and install compatible Renovate version
NODE_VERSION=$(node --version | cut -d'v' -f2)
if [[ $(echo "$NODE_VERSION 24.10.0" | awk '{print ($1 >= $2)}') == 1 ]]; then
echo "Installing latest Renovate for Node.js $NODE_VERSION"
npm install -g renovate@latest
else
echo "Installing compatible Renovate version for Node.js $NODE_VERSION"
npm install -g renovate@40.3.2
fi
fi
echo "✓ Renovate CLI available"
# Validate configuration syntax
echo ""
echo "🔧 Validating renovate.json syntax..."
# First, validate JSON syntax
if ! node -e "
try {
const config = JSON.parse(require('fs').readFileSync('renovate.json', 'utf8'));
console.log('✓ JSON syntax is valid');
console.log('✓ Configuration has', Object.keys(config).length, 'top-level properties');
} catch(e) {
console.error('❌ JSON syntax error:', e.message);
process.exit(1);
}"; then
exit 1
fi
# Then, test Renovate can parse the config (basic validation)
echo "🔍 Testing Renovate configuration parsing..."
if timeout 30 renovate --dry-run --log-level=warn . 2>&1 | grep -qi "error\|fatal"; then
echo "⚠️ Renovate reported warnings/errors during config parsing"
echo " Run 'renovate --dry-run --log-level=debug .' for detailed analysis"
echo " This may be normal for first-time setup"
else
echo "✓ Renovate configuration parsing completed"
fi
# Check for required package files
echo ""
echo "📋 Checking for supported package managers..."
PACKAGE_FILES_FOUND=0
# Python (uv/pip)
if [ -f "backend/pyproject.toml" ]; then
echo "✓ Python: backend/pyproject.toml"
PACKAGE_FILES_FOUND=$((PACKAGE_FILES_FOUND + 1))
fi
# Node.js (npm/yarn)
if [ -f "frontend/package.json" ]; then
echo "✓ Node.js: frontend/package.json"
PACKAGE_FILES_FOUND=$((PACKAGE_FILES_FOUND + 1))
fi
# Docker
DOCKERFILE_COUNT=$(find . -name "Dockerfile*" -type f | wc -l)
if [ $DOCKERFILE_COUNT -gt 0 ]; then
echo "✓ Docker: $DOCKERFILE_COUNT Dockerfile(s) found"
PACKAGE_FILES_FOUND=$((PACKAGE_FILES_FOUND + 1))
fi
# GitHub Actions (if any)
WORKFLOW_COUNT=$(find .gitea/workflows -name "*.yml" -o -name "*.yaml" 2>/dev/null | wc -l)
if [ $WORKFLOW_COUNT -gt 0 ]; then
echo "✓ Gitea Actions: $WORKFLOW_COUNT workflow(s) found"
fi
if [ $PACKAGE_FILES_FOUND -eq 0 ]; then
echo "⚠️ No supported package files found"
echo " Renovate looks for: pyproject.toml, package.json, Dockerfile, etc."
else
echo "✓ Found $PACKAGE_FILES_FOUND package manager types"
fi
# Validate common configuration issues
echo ""
echo "🔍 Checking configuration best practices..."
# Check for timezone setting
if grep -q "timezone" renovate.json; then
echo "✓ Timezone configured"
else
echo " Consider adding timezone setting for consistent scheduling"
fi
# Check for schedule configuration
if grep -q "schedule" renovate.json; then
echo "✓ Update schedule configured"
else
echo " Consider adding schedule to control when updates run"
fi
# Check for automerge rules
if grep -q "automerge" renovate.json; then
echo "✓ Automerge rules configured"
else
echo " Consider configuring automerge for safe updates"
fi
# Check for vulnerability alerts
if grep -q "vulnerabilityAlerts\|osvVulnerabilityAlerts" renovate.json; then
echo "✓ Security vulnerability alerts enabled"
else
echo "⚠️ Consider enabling vulnerability alerts for security updates"
fi
echo ""
echo "🚀 Next Steps for Gitea Setup:"
echo "1. Create a Gitea API token with repository access"
echo "2. Add the token as RENOVATE_TOKEN in repository secrets"
echo "3. Enable the renovate.yml workflow in Gitea Actions"
echo "4. Test with manual workflow trigger (dry-run mode)"
echo ""
echo "📚 Documentation: docs/RENOVATE_SETUP_GUIDE.md"
echo ""
echo "✅ Configuration validation complete!"