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