This commit is contained in:
48
.drone.yml
48
.drone.yml
@@ -18,10 +18,10 @@ steps:
|
||||
- echo "Running flake8 linting..."
|
||||
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
- echo "Checking code formatting with black..."
|
||||
- black --check --diff . || echo "⚠️ Code formatting issues found"
|
||||
- black --check --diff . || echo "WARNING Code formatting issues found"
|
||||
- echo "Checking import sorting..."
|
||||
- isort --check-only --diff . || echo "⚠️ Import sorting issues found"
|
||||
- echo "✅ Python checks completed"
|
||||
- isort --check-only --diff . || echo "WARNING Import sorting issues found"
|
||||
- echo "SUCCESS Python checks completed"
|
||||
|
||||
# Проверка качества Frontend кода
|
||||
- name: frontend-lint
|
||||
@@ -30,10 +30,10 @@ steps:
|
||||
- cd frontend
|
||||
- npm ci --silent
|
||||
- echo "Running TypeScript compilation check..."
|
||||
- npx tsc --noEmit || echo "⚠️ TypeScript errors found"
|
||||
- npx tsc --noEmit || echo "WARNING TypeScript errors found"
|
||||
- echo "Running ESLint..."
|
||||
- npm run lint || echo "⚠️ ESLint warnings found (non-blocking)"
|
||||
- echo "✅ Frontend checks completed"
|
||||
- npm run lint || echo "WARNING ESLint warnings found (non-blocking)"
|
||||
- echo "SUCCESS Frontend checks completed"
|
||||
|
||||
# Тестирование Backend
|
||||
- name: python-tests
|
||||
@@ -42,8 +42,8 @@ steps:
|
||||
- cd backend
|
||||
- pip install --no-cache-dir -r requirements.txt pytest pytest-asyncio pytest-cov
|
||||
- echo "Running Python tests..."
|
||||
- python -m pytest tests/ -v --cov=. --cov-report=term-missing || echo "⚠️ Some tests failed (non-blocking)"
|
||||
- echo "✅ Python tests completed"
|
||||
- python -m pytest tests/ -v --cov=. --cov-report=term-missing || echo "WARNING Some tests failed (non-blocking)"
|
||||
- echo "SUCCESS Python tests completed"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
@@ -56,8 +56,8 @@ steps:
|
||||
- cd frontend
|
||||
- npm ci --silent
|
||||
- echo "Running frontend tests..."
|
||||
- npm test -- --run --reporter=verbose || echo "⚠️ Some frontend tests failed (non-blocking)"
|
||||
- echo "✅ Frontend tests completed"
|
||||
- npm test -- --run --reporter=verbose || echo "WARNING Some frontend tests failed (non-blocking)"
|
||||
- echo "SUCCESS Frontend tests completed"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
@@ -70,10 +70,10 @@ steps:
|
||||
- cd backend
|
||||
- pip install --no-cache-dir safety bandit
|
||||
- echo "Checking for known security vulnerabilities..."
|
||||
- safety check --file=requirements.txt --exit-zero || echo "⚠️ Security warnings found"
|
||||
- safety check --file=requirements.txt --exit-zero || echo "WARNING Security warnings found"
|
||||
- echo "Running bandit security analysis..."
|
||||
- bandit -r . -f json -o bandit-report.json || echo "⚠️ Security issues found"
|
||||
- echo "✅ Security checks completed"
|
||||
- bandit -r . -f json -o bandit-report.json || echo "WARNING Security issues found"
|
||||
- echo "SUCCESS Security checks completed"
|
||||
|
||||
# Проверка безопасности Frontend зависимостей
|
||||
- name: frontend-security
|
||||
@@ -82,8 +82,8 @@ steps:
|
||||
- cd frontend
|
||||
- npm ci --silent
|
||||
- echo "Running npm audit..."
|
||||
- npm audit --audit-level=moderate || echo "⚠️ Security warnings found"
|
||||
- echo "✅ Frontend security checks completed"
|
||||
- npm audit --audit-level=moderate || echo "WARNING Security warnings found"
|
||||
- echo "SUCCESS Frontend security checks completed"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@@ -114,7 +114,7 @@ steps:
|
||||
- npm run build
|
||||
- echo "Frontend build size:"
|
||||
- du -sh dist/
|
||||
- echo "✅ Frontend build completed"
|
||||
- echo "SUCCESS Frontend build completed"
|
||||
volumes:
|
||||
- name: frontend-dist
|
||||
path: /drone/src/frontend/dist
|
||||
@@ -126,7 +126,7 @@ steps:
|
||||
- echo "Saving frontend build artifacts..."
|
||||
- tar -czf frontend-dist.tar.gz -C frontend dist/
|
||||
- ls -la frontend-dist.tar.gz
|
||||
- echo "✅ Frontend artifacts saved"
|
||||
- echo "SUCCESS Frontend artifacts saved"
|
||||
volumes:
|
||||
- name: frontend-dist
|
||||
path: /drone/src/frontend/dist
|
||||
@@ -195,9 +195,9 @@ steps:
|
||||
- docker run --rm -d --name mc-panel-test -p 8001:8000 registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8}
|
||||
- sleep 30
|
||||
- echo "Checking if application is responding..."
|
||||
- docker exec mc-panel-test curl -f http://localhost:8000/ || echo "⚠️ Health check failed"
|
||||
- docker exec mc-panel-test curl -f http://localhost:8000/ || echo "WARNING Health check failed"
|
||||
- docker stop mc-panel-test
|
||||
- echo "✅ Image test completed"
|
||||
- echo "SUCCESS Image test completed"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
@@ -218,7 +218,7 @@ steps:
|
||||
- trivy image --exit-code 0 --severity HIGH,CRITICAL --format table --username $TRIVY_USERNAME --password $TRIVY_PASSWORD registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8}
|
||||
- echo "Generating detailed security report..."
|
||||
- trivy image --format json --output trivy-report.json --username $TRIVY_USERNAME --password $TRIVY_PASSWORD registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8} || true
|
||||
- echo "✅ Security scan completed"
|
||||
- echo "SUCCESS Security scan completed"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
@@ -262,7 +262,7 @@ steps:
|
||||
- echo "$STAGING_KEY" | base64 -d > /tmp/ssh_key
|
||||
- chmod 600 /tmp/ssh_key
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $STAGING_USER@$STAGING_HOST "docker pull registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8} && docker-compose -f /opt/mc-panel/docker-compose.staging.yml up -d"
|
||||
- echo "✅ Staging deployment completed"
|
||||
- echo "SUCCESS Staging deployment completed"
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
@@ -300,7 +300,7 @@ steps:
|
||||
- echo "$PROD_KEY" | base64 -d > /tmp/ssh_key
|
||||
- chmod 600 /tmp/ssh_key
|
||||
- ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key $PROD_USER@$PROD_HOST "docker pull registry.nevetime.ru/mc-panel:${DRONE_TAG} && docker-compose -f /opt/mc-panel/docker-compose.prod.yml up -d"
|
||||
- echo "✅ Production deployment completed"
|
||||
- echo "SUCCESS Production deployment completed"
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
@@ -336,9 +336,9 @@ steps:
|
||||
format: markdown
|
||||
message: >
|
||||
{{#success build.status}}
|
||||
✅ **MC Panel Build Success**
|
||||
SUCCESS **MC Panel Build Success**
|
||||
{{else}}
|
||||
❌ **MC Panel Build Failed**
|
||||
ERROR **MC Panel Build Failed**
|
||||
{{/success}}
|
||||
|
||||
**Repository:** {{repo.name}}
|
||||
|
||||
Reference in New Issue
Block a user