item-atlas/.drone.yml

168 lines
3.9 KiB
YAML

kind: pipeline
type: docker
name: backend-ci
concurrency:
limit: 1
platform:
os: linux
arch: amd64
services:
- name: postgres
image: postgres:15-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- name: verify
image: maven:3.9.11-eclipse-temurin-21-alpine
environment:
ATLAS_LOCAL_PASSWORD: atlas-ci-example
ATLAS_DELIVERY_PASSWORD: atlas-ci-delivery-example
commands:
- sed -i 's|dl-cdn.alpinelinux.org/alpine|mirrors.aliyun.com/alpine|' /etc/apk/repositories
- apk add --no-cache python3 postgresql-client
- mvn -B -ntp -f backend/pom.xml verify
- sh deploy/local/ci-smoke.sh
- name: build-admin
image: node:24-alpine
commands:
- npm --prefix apps/admin ci --no-audit --no-fund
- npm --prefix apps/admin run build
- name: build-pc
image: node:24-alpine
commands:
- npm --prefix apps/pc ci --no-audit --no-fund
- npm --prefix apps/pc run build
- name: build-h5
image: node:24-alpine
commands:
- npm --prefix apps/h5 ci --no-audit --no-fund
- npm --prefix apps/h5 run build
trigger:
event: [push, pull_request, tag]
---
kind: pipeline
type: docker
name: backend-publish
platform:
os: linux
arch: arm64
node:
atlas-release: "true"
depends_on:
- backend-ci
steps:
- name: package
image: maven:3.9.11-eclipse-temurin-21-alpine
commands:
- mvn -B -ntp -f backend/pom.xml -DskipTests package
- name: publish-gateway
image: plugins/docker:21.3.8
depends_on: [package]
settings:
registry: git.tutudog.com
repo: git.tutudog.com/dongjf/item-atlas-gateway
username:
from_secret: atlas_registry_username
password:
from_secret: atlas_registry_token
dockerfile: backend/gateway/Dockerfile
context: backend/gateway
platform: linux/arm64
tags: ["${DRONE_COMMIT_SHA}"]
- name: publish-inventory-service
image: plugins/docker:21.3.8
depends_on: [publish-gateway]
settings:
registry: git.tutudog.com
repo: git.tutudog.com/dongjf/item-atlas-inventory-service
username:
from_secret: atlas_registry_username
password:
from_secret: atlas_registry_token
dockerfile: backend/inventory-service/Dockerfile
context: backend/inventory-service
platform: linux/arm64
tags: ["${DRONE_COMMIT_SHA}"]
- name: publish-intake-service
image: plugins/docker:21.3.8
depends_on: [publish-inventory-service]
settings:
registry: git.tutudog.com
repo: git.tutudog.com/dongjf/item-atlas-intake-service
username:
from_secret: atlas_registry_username
password:
from_secret: atlas_registry_token
dockerfile: backend/intake-service/Dockerfile
context: backend/intake-service
platform: linux/arm64
tags: ["${DRONE_COMMIT_SHA}"]
trigger:
event: [tag]
ref: [refs/tags/v*]
---
kind: pipeline
type: docker
name: deploy-staging
platform:
os: linux
arch: arm64
node:
atlas-release: "true"
steps:
- name: helm-upgrade
image: alpine/helm:3.20.0
environment:
HELM_DRIVER: configmap
ATLAS_OTLP_TRACES_ENDPOINT: http://atlas-alloy.item-atlas-observability.svc:4318/v1/traces
ATLAS_KUBECONFIG_B64:
from_secret: atlas_staging_kubeconfig_b64
commands:
- sh deploy/helm/promote.sh item-atlas-staging
trigger:
event: [promote]
target: [staging]
ref: [refs/tags/v*]
---
kind: pipeline
type: docker
name: deploy-production
platform:
os: linux
arch: arm64
node:
atlas-release: "true"
steps:
- name: helm-upgrade
image: alpine/helm:3.20.0
environment:
ATLAS_KUBECONFIG_B64:
from_secret: atlas_production_kubeconfig_b64
commands:
- sh deploy/helm/promote.sh item-atlas
trigger:
event: [promote]
target: [production]
ref:
include: [refs/tags/v*]
exclude: [refs/tags/v*-*]