fixed drone.yml
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2026-01-18 20:27:54 +06:00
parent e66ecbf178
commit 49affe3891

View File

@@ -12,71 +12,29 @@ steps:
image: python:3.11-slim image: python:3.11-slim
commands: commands:
- cd backend - cd backend
- pip install --no-cache-dir flake8 black isort - pip install flake8
- 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..."
- black --check --diff . || echo "WARNING Code formatting issues found"
- echo "Checking import sorting..."
- isort --check-only --diff . || echo "WARNING Import sorting issues found"
- echo "SUCCESS Python checks completed"
- name: frontend-lint - name: frontend-lint
image: node:20-alpine image: node:20-alpine
commands: commands:
- cd frontend - cd frontend
- npm ci --silent - npm ci --silent
- echo "Running TypeScript compilation check..." - npm run lint || echo "ESLint warnings found"
- npx tsc --noEmit || echo "WARNING TypeScript errors found"
- echo "Running ESLint..."
- npm run lint || echo "WARNING ESLint warnings found (non-blocking)"
- echo "SUCCESS Frontend checks completed"
- name: python-tests
image: python:3.11-slim
commands:
- 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 "WARNING Some tests failed (non-blocking)"
- echo "SUCCESS Python tests completed"
when:
event:
- push
- pull_request
- name: frontend-tests
image: node:20-alpine
commands:
- cd frontend
- npm ci --silent
- echo "Running frontend tests..."
- npm test -- --run --reporter=verbose || echo "WARNING Some frontend tests failed (non-blocking)"
- echo "SUCCESS Frontend tests completed"
when:
event:
- push
- pull_request
- name: python-security - name: python-security
image: python:3.11-slim image: python:3.11-slim
commands: commands:
- cd backend - cd backend
- pip install --no-cache-dir safety bandit - pip install safety
- 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 "WARNING Security issues found"
- echo "SUCCESS Security checks completed"
- name: frontend-security - name: frontend-security
image: node:20-alpine image: node:20-alpine
commands: commands:
- cd frontend - cd frontend
- npm ci --silent - npm ci --silent
- echo "Running npm audit..." - npm audit --audit-level=moderate || echo "Security warnings found"
- npm audit --audit-level=moderate || echo "WARNING Security warnings found"
- echo "SUCCESS Frontend security checks completed"
--- ---
kind: pipeline kind: pipeline
@@ -115,32 +73,12 @@ steps:
build_args: build_args:
- BUILD_DATE=${DRONE_BUILD_CREATED} - BUILD_DATE=${DRONE_BUILD_CREATED}
- VCS_REF=${DRONE_COMMIT_SHA} - VCS_REF=${DRONE_COMMIT_SHA}
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}-${DRONE_BUILD_NUMBER}} - VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
when: when:
event: event:
- push - push
- tag - tag
- name: test-image
image: docker:dind
volumes:
- name: docker-sock
path: /var/run/docker.sock
commands:
- echo "Testing built Docker image..."
- 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 "WARNING Health check failed"
- docker stop mc-panel-test
- echo "SUCCESS Image test completed"
when:
event:
- push
- tag
depends_on:
- build-and-push
- name: scan-image - name: scan-image
image: aquasec/trivy:latest image: aquasec/trivy:latest
environment: environment:
@@ -150,8 +88,7 @@ steps:
from_secret: docker_password from_secret: docker_password
commands: commands:
- echo "Scanning image for vulnerabilities..." - echo "Scanning image for vulnerabilities..."
- 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 registry.nevetime.ru/mc-panel:${DRONE_COMMIT_SHA:0:8}
- echo "SUCCESS Security scan completed"
when: when:
event: event:
- push - push
@@ -159,11 +96,6 @@ steps:
depends_on: depends_on:
- build-and-push - build-and-push
volumes:
- name: docker-sock
host:
path: /var/run/docker.sock
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
@@ -190,11 +122,10 @@ steps:
from_secret: staging_ssh_key from_secret: staging_ssh_key
commands: commands:
- apk add --no-cache openssh-client - apk add --no-cache openssh-client
- echo "Deploying to staging environment..." - echo "Deploying to staging..."
- 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}"
- echo "SUCCESS Staging deployment completed"
when: when:
event: event:
- push - push
@@ -227,56 +158,10 @@ steps:
from_secret: production_ssh_key from_secret: production_ssh_key
commands: commands:
- apk add --no-cache openssh-client - apk add --no-cache openssh-client
- echo "Deploying to production environment..." - echo "Deploying to production..."
- 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}"
- echo "SUCCESS Production deployment completed"
when: when:
event: event:
- tag - tag
---
kind: pipeline
type: docker
name: notify
trigger:
event:
- push
- tag
- pull_request
status:
- success
- failure
depends_on:
- code-quality
- build-and-publish
steps:
- name: notify-telegram
image: appleboy/drone-telegram
settings:
token:
from_secret: telegram_bot_token
to:
from_secret: telegram_chat_id
format: markdown
message: >
{{#success build.status}}
SUCCESS **MC Panel Build Success**
{{else}}
ERROR **MC Panel Build Failed**
{{/success}}
**Repository:** {{repo.name}}
**Branch:** {{build.branch}}
**Commit:** {{build.commit}}
**Author:** {{build.author}}
**Message:** {{build.message}}
**Build:** [#{{build.number}}]({{build.link}})
when:
status:
- success
- failure