devops #2

Merged
trevor merged 4 commits from devops into main 2025-09-11 02:56:20 +00:00
3 changed files with 25 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
kind: pipeline
type: docker
name: quiz-bot-ci-cd
name: multibot-ci
trigger:
branch:
@@ -11,67 +11,33 @@ trigger:
- push
- pull_request
services:
- name: docker
image: docker:27-dind
privileged: true
command:
- --host=tcp://0.0.0.0:2375
environment:
DOCKER_TLS_CERTDIR: ""
steps:
- name: prepare
image: alpine/git:latest
environment:
DOCKER_HOST: tcp://docker:2375
- name: install-deps
image: python:3.11-slim
commands:
- echo "🚀 Pipeline started for branch ${DRONE_BRANCH}"
# BusyBox ash может не поддерживать ${VAR:0:8}; безопаснее так:
- echo "📝 Commit: $(echo ${DRONE_COMMIT_SHA} | cut -c1-8)"
- echo "👤 Author: ${DRONE_COMMIT_AUTHOR}"
- echo "📅 Build: ${DRONE_BUILD_NUMBER}"
- git --version
- pip install --upgrade pip
- pip install -r requirements.txt
- name: lint
image: python:3.12-slim
image: python:3.11-slim
commands:
- echo "🔍 Installing linting tools..."
- pip install --no-cache-dir flake8 black isort mypy
- echo "🎨 Running Black formatter check..."
- black --check --diff src/ config/ tools/ tests/ || true
- echo "📦 Running isort import sorting check..."
- isort --check-only --diff src/ config/ tools/ tests/ || true
- echo "🔧 Running flake8 linting..."
- flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true
- echo "✅ Linting completed"
- pip install flake8
- flake8 .
- name: test
image: python:3.12-slim
commands:
- pip install --no-cache-dir -r requirements.txt
- python -m pytest tests/ -v --tb=short || true
- python tests/test_bot.py || true
- name: docker-build
image: plugins/docker:27
settings:
repo: ${DRONE_REPO} # или ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME}
tags:
- latest
- ${DRONE_COMMIT_SHA}
dockerfile: Dockerfile
# Если не хочешь пушить — добавь:
# dry_run: true
- name: security
image: python:3.12-slim
commands:
- pip install --no-cache-dir safety bandit
- safety check --json || true
- bandit -r src/ -f json || true
- name: typecheck
image: python:3.12-slim
commands:
- pip install --no-cache-dir mypy types-requests
- mypy src/ --ignore-missing-imports || true
- name: docker_build
- name: docker-test
image: docker:27-cli
environment:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
commands:
- echo "🐳 Docker version info:"
- docker version
- echo "🔨 Building Docker image..."
- docker run --rm ${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA} python -c "print('image ok')"
depends_on:
- docker-build

View File

@@ -46,7 +46,9 @@ quiz_test/
- 📖 [Быстрый старт](docs/QUICKSTART.md) - Начало работы с проектом
- 🐳 [Docker инструкции](docs/DOCKER_README.md) - Контейнеризация и развертывание
- 🏗️ [DevOps инфраструктура](docs/DEVOPS_SUMMARY.md) - CI/CD и автоматизация
- 🔧 [Инфраструктура](docs/INFRASTRUCTURE.md) - Архитектура и компоненты
- <EFBFBD> [Drone 1.x+ конфигурация](docs/DRONE_1.x_CONFIG.md) - Современный CI/CD pipeline
- 🔄 [Миграция Drone 0.8](docs/DRONE_0.8_MIGRATION.md) - Переход с устаревшей версии
- <20>🔧 [Инфраструктура](docs/INFRASTRUCTURE.md) - Архитектура и компоненты
- 🔧 [Отчет по исправлениям](docs/FIX_REPORT.md) - История изменений
## 🚀 Быстрый старт

Binary file not shown.