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