Compare commits
1 Commits
de8ad67038
...
codex/pr-c
| Author | SHA1 | Date | |
|---|---|---|---|
| 104bdb70c2 |
183
.drone.yml
183
.drone.yml
@@ -4,42 +4,26 @@ name: code-quality
|
|||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: python-lint
|
- name: backend-sanity
|
||||||
image: python:3.11-slim
|
image: python:3.11-slim
|
||||||
commands:
|
commands:
|
||||||
- cd backend
|
- cd backend
|
||||||
- pip install flake8
|
- python -m py_compile main.py auth.py daemons.py oidc_config.py
|
||||||
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
||||||
|
|
||||||
- name: frontend-lint
|
- name: frontend-build-check
|
||||||
image: node:20-alpine
|
image: node:20-alpine
|
||||||
commands:
|
commands:
|
||||||
- cd frontend
|
- cd frontend
|
||||||
- npm ci --silent
|
- npm ci --silent
|
||||||
- npm run lint || echo "ESLint warnings found"
|
- npm run build
|
||||||
|
|
||||||
- name: python-security
|
|
||||||
image: python:3.11-slim
|
|
||||||
commands:
|
|
||||||
- cd backend
|
|
||||||
- pip install safety
|
|
||||||
- safety check --file=requirements.txt --exit-zero || echo "Security warnings found"
|
|
||||||
|
|
||||||
- name: frontend-security
|
|
||||||
image: node:20-alpine
|
|
||||||
commands:
|
|
||||||
- cd frontend
|
|
||||||
- npm ci --silent
|
|
||||||
- npm audit --audit-level=moderate || echo "Security warnings found"
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build-backend
|
name: build-images
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
@@ -50,19 +34,17 @@ trigger:
|
|||||||
- push
|
- push
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- code-quality
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-backend-image
|
- name: build-backend-image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: registry.nevetime.ru
|
registry: registry.nevetime.ru
|
||||||
repo: registry.nevetime.ru/mc-panel-backend
|
repo: registry.nevetime.ru/mc-panel-backend
|
||||||
|
cache_from:
|
||||||
|
- registry.nevetime.ru/mc-panel-backend:latest
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
- ${DRONE_BUILD_NUMBER}
|
||||||
- ${DRONE_BRANCH}
|
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
dockerfile: backend/Dockerfile
|
dockerfile: backend/Dockerfile
|
||||||
context: backend
|
context: backend
|
||||||
@@ -70,164 +52,21 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
build_args:
|
|
||||||
- BUILD_DATE=${DRONE_BUILD_CREATED}
|
|
||||||
- VCS_REF=${DRONE_COMMIT_SHA}
|
|
||||||
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build-frontend
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- code-quality
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build-frontend-image
|
- name: build-frontend-image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: registry.nevetime.ru
|
registry: registry.nevetime.ru
|
||||||
repo: registry.nevetime.ru/mc-panel-frontend
|
repo: registry.nevetime.ru/mc-panel-frontend
|
||||||
|
cache_from:
|
||||||
|
- registry.nevetime.ru/mc-panel-frontend:latest
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
- ${DRONE_BUILD_NUMBER}
|
||||||
- ${DRONE_BRANCH}
|
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
dockerfile: frontend/Dockerfile
|
dockerfile: frontend/Dockerfile
|
||||||
context: frontend
|
context: frontend
|
||||||
target: production
|
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
build_args:
|
|
||||||
- BUILD_DATE=${DRONE_BUILD_CREATED}
|
|
||||||
- VCS_REF=${DRONE_COMMIT_SHA}
|
|
||||||
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build-monolith
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- code-quality
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build-monolith-image
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: registry.nevetime.ru
|
|
||||||
repo: registry.nevetime.ru/mc-panel
|
|
||||||
tags:
|
|
||||||
- latest
|
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
|
||||||
- ${DRONE_BRANCH}
|
|
||||||
auto_tag: true
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
context: .
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
build_args:
|
|
||||||
- BUILD_DATE=${DRONE_BUILD_CREATED}
|
|
||||||
- VCS_REF=${DRONE_COMMIT_SHA}
|
|
||||||
- VERSION=${DRONE_TAG:-${DRONE_BRANCH}}
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: deploy-staging
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- develop
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build-backend
|
|
||||||
- build-frontend
|
|
||||||
- build-monolith
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: deploy-separate-services
|
|
||||||
image: alpine:latest
|
|
||||||
environment:
|
|
||||||
STAGING_HOST:
|
|
||||||
from_secret: staging_host
|
|
||||||
STAGING_USER:
|
|
||||||
from_secret: staging_user
|
|
||||||
STAGING_KEY:
|
|
||||||
from_secret: staging_ssh_key
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache openssh-client
|
|
||||||
- echo "Deploying separate services to staging..."
|
|
||||||
- echo "$STAGING_KEY" | base64 -d > /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-backend:${DRONE_COMMIT_SHA:0:8} && docker pull registry.nevetime.ru/mc-panel-frontend:${DRONE_COMMIT_SHA:0:8}"
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: deploy-production
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
ref:
|
|
||||||
- refs/tags/v*
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- build-backend
|
|
||||||
- build-frontend
|
|
||||||
- build-monolith
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: deploy-separate-services
|
|
||||||
image: alpine:latest
|
|
||||||
environment:
|
|
||||||
PROD_HOST:
|
|
||||||
from_secret: production_host
|
|
||||||
PROD_USER:
|
|
||||||
from_secret: production_user
|
|
||||||
PROD_KEY:
|
|
||||||
from_secret: production_ssh_key
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache openssh-client
|
|
||||||
- echo "Deploying separate services to production..."
|
|
||||||
- echo "$PROD_KEY" | base64 -d > /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-backend:${DRONE_TAG} && docker pull registry.nevetime.ru/mc-panel-frontend:${DRONE_TAG}"
|
|
||||||
Reference in New Issue
Block a user