From a188cd5d8ff5025e028a74c0795324247c32ce67 Mon Sep 17 00:00:00 2001 From: "Andrey K. Choi" Date: Thu, 11 Sep 2025 08:38:36 +0900 Subject: [PATCH] drone 1.x syntax fix --- .drone.yml | 105 ++++++++++++++--------------------------------------- 1 file changed, 28 insertions(+), 77 deletions(-) diff --git a/.drone.yml b/.drone.yml index 98e4dbc..f2860d1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,23 +1,39 @@ +kind: pipeline +type: docker +name: quiz-bot-ci-cd + +trigger: + branch: + - main + - develop + - "feature/*" + event: + - push + - pull_request + services: - docker: + - name: 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: "" -pipeline: - - prepare: +steps: + - name: prepare image: alpine/git:latest + environment: + DOCKER_HOST: tcp://docker:2375 commands: - echo "๐Ÿš€ Pipeline started for branch ${DRONE_BRANCH}" - - echo "๐Ÿ“ Commit: ${DRONE_COMMIT_SHA:0:8}" + # 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 - lint: + - name: lint image: python:3.12-slim commands: - echo "๐Ÿ” Installing linting tools..." @@ -30,28 +46,28 @@ pipeline: - flake8 src/ config/ tools/ tests/ --max-line-length=88 --extend-ignore=E203,W503 || true - echo "โœ… Linting completed" - test: + - 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 - security: + - 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 - typecheck: + - name: typecheck image: python:3.12-slim commands: - pip install --no-cache-dir mypy types-requests - mypy src/ --ignore-missing-imports || true - docker_build: - image: docker:27 + - name: docker_build + image: docker:27-cli environment: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" @@ -59,68 +75,3 @@ pipeline: - echo "๐Ÿณ Docker version info:" - docker version - echo "๐Ÿ”จ Building Docker image..." - - docker build -t quiz-bot:${DRONE_COMMIT_SHA} . - - docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:latest - - echo "๐Ÿ“ฆ Docker build completed" - - docker images | grep quiz-bot - when: - branch: [ main, develop ] - event: [ push, pull_request ] - - docker_test: - image: docker:27 - environment: - DOCKER_HOST: tcp://docker:2375 - DOCKER_TLS_CERTDIR: "" - commands: - - echo "๐Ÿงช Testing Docker image..." - - docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import src.bot; print('โœ… Bot import successful')" - - docker run --rm quiz-bot:${DRONE_COMMIT_SHA} python -c "import config.config; print('โœ… Config import successful')" - - echo "โœ… Docker tests completed" - when: - branch: [ main, develop ] - event: [ push, pull_request ] - - quality: - image: python:3.12-slim - commands: - - pip install --no-cache-dir flake8 radon - - radon cc src/ -s || true - - radon mi src/ -s || true - - deploy: - image: docker:27 - environment: - DOCKER_HOST: tcp://docker:2375 - DOCKER_TLS_CERTDIR: "" - commands: - - docker tag quiz-bot:${DRONE_COMMIT_SHA} quiz-bot:production - - echo "Deployment completed (simulation)" - when: - branch: [ main ] - event: [ push ] - - notify_success: - image: alpine:latest - commands: - - echo "๐ŸŽ‰ Pipeline completed successfully!" - - echo "๐ŸŒฟ Branch: ${DRONE_BRANCH}" - - echo "๐Ÿ“ Commit: ${DRONE_COMMIT_SHA:0:8}" - - echo "๐Ÿ—๏ธ Build: #${DRONE_BUILD_NUMBER}" - - echo "โœ… Status: SUCCESS" - - echo "๐Ÿ•’ Started: ${DRONE_BUILD_STARTED}" - when: - status: success - - notify_failure: - image: alpine:latest - commands: - - echo "โŒ Pipeline failed!" - - echo "๐ŸŒฟ Branch: ${DRONE_BRANCH}" - - echo "๐Ÿ“ Commit: ${DRONE_COMMIT_SHA:0:8}" - - echo "๐Ÿ—๏ธ Build: #${DRONE_BUILD_NUMBER}" - - echo "๐Ÿ’ฅ Status: FAILURE" - - echo "๐Ÿ•’ Started: ${DRONE_BUILD_STARTED}" - - echo "๐Ÿ” Check logs above for details" - when: - status: failure \ No newline at end of file