From 5baaaa4cba71d0bf45e1374cfdd71e83cef85714 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 28 Mar 2025 10:32:12 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.drone.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2bf3745..467bfaa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,11 +5,26 @@ name: pipeline-1 steps: - - name: build + - name: git-incremental-sync image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/gcr.io/iguazio/alpine:3.17 + volumes: + - name: git-repo-cache + path: /cache commands: - - cd $DRONE_WORKSPACE - - ls /drone/src/ + + - mkdir -p /cache/my-repo + - cd /cache/my-repo + + - | + if [ -d .git ]; then + git remote set-url origin ${DRONE_REPO_URL} + git fetch origin --depth=1 ${DRONE_COMMIT_BRANCH} + git reset --hard ${DRONE_COMMIT_SHA} + else + git clone ${DRONE_REPO_URL} . --depth=1 --branch=${DRONE_COMMIT_BRANCH} + fi + + - cp -r /cache/my-repo ${DRONE_WORKSPACE} node: app: build