48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: microservice-build
|
|
|
|
# 定义全局环境变量
|
|
environment:
|
|
SERVICE: ${DRONE_SERVICE}
|
|
|
|
steps:
|
|
- name: build-service
|
|
image: maven:3-jdk-8
|
|
commands:
|
|
- echo "Building Service: ${SERVICE}"
|
|
- |
|
|
if [ "${SERVICE}" = "gateway-service" ]; then
|
|
echo "Building Gateway Service..."
|
|
|
|
elif [ "${SERVICE}" = "system-service" ]; then
|
|
echo "Building System Service..."
|
|
|
|
else
|
|
echo "Building All Services..."
|
|
|
|
# 如果有其他服务,可以在这里继续添加
|
|
fi
|
|
|
|
- name: test-service
|
|
image: maven:3-jdk-8
|
|
commands:
|
|
- echo "Testing Service: ${SERVICE}"
|
|
- |
|
|
if [ "${SERVICE}" = "gateway-service" ]; then
|
|
echo "Testing Gateway Service..."
|
|
|
|
elif [ "${SERVICE}" = "system-service" ]; then
|
|
echo "Testing System Service..."
|
|
|
|
else
|
|
echo "Testing All Services..."
|
|
|
|
# 如果有其他服务,可以在这里继续添加
|
|
fi
|
|
|
|
parameters:
|
|
SERVICE:
|
|
description: "The service to build and test. Leave empty to build and test all services."
|
|
default: ""
|