'build'
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
XinWei 2024-08-22 17:31:24 +08:00
parent f82a1e9aef
commit b000a5a4cc

View File

@ -2,27 +2,40 @@ kind: pipeline
type: docker type: docker
name: microservice-build name: microservice-build
# 定义全局环境变量
environment:
SERVICE: ${DRONE_SERVICE}
steps: steps:
- name: build-service - name: build-service
image: maven:3-jdk-8 image: maven:3-jdk-8
environment:
SERVICE: ${DRONE_SERVICE} # 在步骤中引用传递的参数
commands: commands:
# - echo "Building Service: ${SERVICE}" # - echo "Building Service: ${SERVICE}"
- if [ "${SERVICE}" = "gateway-service" ]; then echo "Building Gateway Service..."; fi - |
- if [ "${SERVICE}" = "system-service" ]; then echo "Building System Service..."; fi if [ "${SERVICE}" = "gateway-service" ]; then
- if [ "${SERVICE}" = "" ]; then echo "Building All Services..."; fi echo "Building Gateway Service..."
elif [ "${SERVICE}" = "system-service" ]; then
echo "Building System Service..."
else
echo "Building All Services..."
# 如果有其他服务,可以在这里继续添加
fi
- name: test-service - name: test-service
image: maven:3-jdk-8 image: maven:3-jdk-8
environment:
SERVICE: ${DRONE_SERVICE} # 在步骤中引用传递的参数
commands: commands:
# - echo "Testing Service: ${SERVICE}" # - echo "Testing Service: ${SERVICE}"
- if [ "${SERVICE}" = "gateway-service" ]; then echo "Testing Gateway Service..."; fi - |
- if [ "${SERVICE}" = "system-service" ]; then echo "Testing System Service..."; fi if [ "${SERVICE}" = "gateway-service" ]; then
- if [ "${SERVICE}" = "" ]; then echo "Testing All Services..."; fi echo "Testing Gateway Service..."
elif [ "${SERVICE}" = "system-service" ]; then
echo "Testing System Service..."
else
echo "Testing All Services..."
# 如果有其他服务,可以在这里继续添加
fi
# Drone 参数部分
parameters: parameters:
SERVICE: SERVICE:
description: "The service to build and test. Leave empty to build and test all services." description: "The service to build and test. Leave empty to build and test all services."