From fb6853f57c91a00a6a14c3c50aad123be42d782a Mon Sep 17 00:00:00 2001 From: lujianxin <2458505331@qq.com> Date: Tue, 24 Jun 2025 18:10:14 +0800 Subject: [PATCH] =?UTF-8?q?ci(drone):=20=E4=BC=98=E5=8C=96=20Drone?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构构建步骤,提高流程清晰度 - 添加文件存在性检查和错误处理,增强构建鲁棒性 - 优化目录结构创建方式 - 更新 Docker 镜像构建步骤 - 调整 Docker Compose 文件处理方式 - 移除未使用的触发配置 --- .drone.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.drone.yml b/.drone.yml index 92c30b4..2b9d785 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,21 +12,26 @@ steps: - name: build-output path: /home/app/build commands: + - cd /drone/src - mvn clean package -DskipTests=true -pl yudao-gateway,yudao-module-system/yudao-module-system-biz,yudao-module-infra/yudao-module-infra-biz -am - - name: build-jar + - name: copy-jars image: alpine volumes: - name: build-output path: /home/app/build commands: - - mkdir -p /home/app/build/{gateway,system,infra} - - cp yudao-gateway/target/yudao-gateway.jar /home/app/build/gateway/app.jar - - cp yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /home/app/build/system/app.jar - - cp yudao-module-infra/yudao-module-infra-biz/target//yudao-module-infra-biz.jar /home/app/build/infra/app.jar + - mkdir -p /home/app/build/gateway + - mkdir -p /home/app/build/system + - mkdir -p /home/app/build/infra + - ls -l yudao-gateway/target/ # 检查源文件是否存在 + - cp yudao-gateway/target/yudao-gateway.jar /home/app/build/gateway/app.jar || echo "Failed to copy gateway jar" + - cp yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /home/app/build/system/app.jar || echo "Failed to copy system biz jar" + - cp yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /home/app/build/infra/app.jar || echo "Failed to copy infra biz jar" - cp Dockerfile /home/app/build/ + - cp docker-compose.yml /home/app/build/ - - name: build-docker + - name: build-docker-images image: docker volumes: - name: build-output @@ -50,20 +55,16 @@ steps: path: /var/run/docker.sock commands: - cd /home/app/build - - cp docker-compose.yml . - - sed -i "s/\${APP_VERSION}/${APP_VERSION}/g" docker-compose.yml - - docker-compose up -d + - sed -i "s/${APP_VERSION}/${APP_VERSION}/g" docker-compose.yml + - docker-compose -f docker-compose.yml up -d volumes: - name: maven-cache host: path: /home/data/maven/cache + - name: build-output + host: + path: /home/data/maven/build - name: docker host: - path: /var/run/docker.sock - -#trigger: -# event: -# - custom -# ref: -# - refs/tags/version1.1 + path: /var/run/docker.sock \ No newline at end of file