test/.drone.yml

43 lines
1.2 KiB
YAML
Raw Normal View History

2024-08-22 17:14:13 +08:00
kind: pipeline
type: docker
name: microservice-build
2024-08-08 09:43:22 +08:00
2024-08-22 17:14:13 +08:00
steps:
- name: build-service
image: maven:3-jdk-8
2024-08-22 17:31:24 +08:00
environment:
SERVICE: ${DRONE_SERVICE} # 在步骤中引用传递的参数
2024-08-22 17:14:13 +08:00
commands:
2024-08-22 17:24:58 +08:00
# - echo "Building Service: ${SERVICE}"
2024-08-22 17:31:24 +08:00
- |
if [ "${SERVICE}" = "gateway-service" ]; then
echo "Building Gateway Service..."
elif [ "${SERVICE}" = "system-service" ]; then
echo "Building System Service..."
else
echo "Building All Services..."
# 如果有其他服务,可以在这里继续添加
fi
2024-08-08 09:43:22 +08:00
2024-08-22 17:14:13 +08:00
- name: test-service
image: maven:3-jdk-8
2024-08-22 17:31:24 +08:00
environment:
SERVICE: ${DRONE_SERVICE} # 在步骤中引用传递的参数
2024-08-08 09:43:22 +08:00
commands:
2024-08-22 17:24:58 +08:00
# - echo "Testing Service: ${SERVICE}"
2024-08-22 17:31:24 +08:00
- |
if [ "${SERVICE}" = "gateway-service" ]; then
echo "Testing Gateway Service..."
elif [ "${SERVICE}" = "system-service" ]; then
echo "Testing System Service..."
else
echo "Testing All Services..."
# 如果有其他服务,可以在这里继续添加
fi
2024-08-08 09:43:22 +08:00
2024-08-22 17:31:24 +08:00
# Drone 参数部分
2024-08-22 17:14:13 +08:00
parameters:
SERVICE:
description: "The service to build and test. Leave empty to build and test all services."
default: ""