pipeline fix #1
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
87
.drone.yml
87
.drone.yml
@@ -1,37 +1,36 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: quiz-bot-ci-cd
|
||||
# ---------- DRONE 0.8 CONFIG ----------
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
# Ограничим сборки по веткам и событиям
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- "feature/*"
|
||||
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
services:
|
||||
- name: docker
|
||||
docker:
|
||||
image: docker:27-dind
|
||||
privileged: true
|
||||
command:
|
||||
- --host=tcp://0.0.0.0:2375
|
||||
command: [ "--host=tcp://0.0.0.0:2375" ]
|
||||
environment:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
|
||||
steps:
|
||||
- name: prepare
|
||||
pipeline:
|
||||
|
||||
prepare:
|
||||
image: alpine/git:latest
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
commands:
|
||||
- echo "Pipeline started for branch $DRONE_BRANCH"
|
||||
- echo "Commit: $DRONE_COMMIT_SHA"
|
||||
- echo "Author: $DRONE_COMMIT_AUTHOR"
|
||||
- echo "Pipeline started for branch ${DRONE_BRANCH}"
|
||||
- echo "Commit: ${DRONE_COMMIT_SHA}"
|
||||
- echo "Author: ${DRONE_COMMIT_AUTHOR}"
|
||||
- git --version
|
||||
|
||||
- name: lint
|
||||
lint:
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir flake8 black isort mypy
|
||||
@@ -43,7 +42,7 @@ steps:
|
||||
- flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true
|
||||
- echo "Linting completed"
|
||||
|
||||
- name: test
|
||||
test:
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir -r requirements.txt
|
||||
@@ -53,7 +52,7 @@ steps:
|
||||
- python tests/test_bot.py || true
|
||||
- echo "Testing completed"
|
||||
|
||||
- name: security
|
||||
security:
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir safety bandit
|
||||
@@ -63,7 +62,7 @@ steps:
|
||||
- bandit -r src/ -f json || true
|
||||
- echo "Security checks completed"
|
||||
|
||||
- name: typecheck
|
||||
typecheck:
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir mypy types-requests
|
||||
@@ -71,23 +70,23 @@ steps:
|
||||
- mypy src/ --ignore-missing-imports || true
|
||||
- echo "Type checking completed"
|
||||
|
||||
- name: docker-build
|
||||
image: docker:27-cli
|
||||
docker_build:
|
||||
image: docker:27
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
commands:
|
||||
- echo "Building Docker image..."
|
||||
- docker version
|
||||
- docker build -t quiz-bot:${DRONE_COMMIT_SHA} .
|
||||
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:latest
|
||||
- echo "Docker build completed"
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
- develop
|
||||
include: [ main, develop ]
|
||||
|
||||
- name: docker-test
|
||||
image: docker:27-cli
|
||||
docker_test:
|
||||
image: docker:27
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
@@ -95,14 +94,13 @@ steps:
|
||||
- echo "Testing Docker image..."
|
||||
- docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import src.bot; print('Import successful')"
|
||||
- echo "Docker test completed"
|
||||
depends_on:
|
||||
- docker-build
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
- develop
|
||||
include: [ main, develop ]
|
||||
depends_on:
|
||||
- docker_build
|
||||
|
||||
- name: quality
|
||||
quality:
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir flake8 radon
|
||||
@@ -111,8 +109,8 @@ steps:
|
||||
- radon mi src/ -s || true
|
||||
- echo "Quality check completed"
|
||||
|
||||
- name: deploy
|
||||
image: docker:27-cli
|
||||
deploy:
|
||||
image: docker:27
|
||||
environment:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
@@ -121,22 +119,29 @@ steps:
|
||||
- docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:production
|
||||
- echo "Tagged image for production"
|
||||
- echo "Deployment completed (simulation)"
|
||||
depends_on:
|
||||
- docker-test
|
||||
- quality
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
include: [ main ]
|
||||
event:
|
||||
- push
|
||||
include: [ push ]
|
||||
depends_on:
|
||||
- docker_test
|
||||
- quality
|
||||
|
||||
- name: notify
|
||||
notify_success:
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "Pipeline completed for $DRONE_BRANCH"
|
||||
- echo "Build status: ${DRONE_BUILD_STATUS}"
|
||||
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
||||
- echo "Build status: SUCCESS"
|
||||
- echo "All checks finished."
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
status: success
|
||||
|
||||
notify_failure:
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "Pipeline completed for ${DRONE_BRANCH}"
|
||||
- echo "Build status: FAILURE"
|
||||
- echo "Check previous steps for errors."
|
||||
when:
|
||||
status: failure
|
||||
|
||||
Reference in New Issue
Block a user