From 36f396de6e054350a70a89e3e16ce214763dad97 Mon Sep 17 00:00:00 2001 From: daiyb <570956418@qq.com> Date: Fri, 17 Oct 2025 13:53:43 +0800 Subject: [PATCH 1/2] Update .drone.yml --- .drone.yml | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0fae4d7..2f80d86 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,7 +4,7 @@ name: chain-dci【K8s-测试服】 volumes: - name: pkgdeps host: - path: /mnt/storage/data/drone/define_cache/chain-dci + path: /mnt/data/drone/define_cache/chain-dci - name: docker host: path: /var/run/docker.sock @@ -12,19 +12,39 @@ volumes: host: path: /etc/docker/daemon.json steps: + - name: clone-and-configure + image: testhub.szjixun.cn:9043/public/plugins/git + environment: + GITEA_USERNAME: + from_secret: GITEA_USERNAME + GITEA_TOKEN: + from_secret: GITEA_TOKEN + commands: + # 手动克隆主仓库 + - git init + - git remote add origin https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn/chain/chain-dci + - git fetch --no-tags origin +refs/heads/dev + - git reset --hard origin/dev + # 配置子模块 URL 重定向 + - git config --global url."https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn/fonchain/oa-proto.git".insteadOf "https://gitea-net.fontree.cn/fonchain/oa-proto.git" + # 配置 HTTPS 凭据 + # - git config --global credential.helper 'store --file=/tmp/git-credentials' + # - echo "https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn" > /tmp/git-credentials + # 更新子模块 + - git submodule update --init --recursive + when: + branch: + - dev - name: fetch submodules image: testhub.szjixun.cn:9043/public/plugins/git pull: if-not-exists commands: + - git config --file=.gitmodules submodule.oa-proto.url https://gitea-inner.fontree.cn/fonchain/oa-proto.git + - git submodule sync - git submodule update --init --force --recursive --remote - name: build image: testhub.szjixun.cn:9043/public/golang:1.20-alpine pull: if-not-exists - network: - mode: bridge - options: - com.docker.network.bridge.host_binding_ipv4: "172.16.100.22" - com.docker.network.bridge.name: "dnmp_default" environment: GOPROXY: "https://goproxy.cn,direct" GOPATH: /go @@ -66,7 +86,6 @@ steps: dashboard: kuboard build_repo: from_secret: build_repo - - name: 钉钉通知 image: testhub.szjixun.cn:9043/public/drone-ding settings: @@ -81,15 +100,11 @@ steps: db_log: true db_type: mysql db_name: notelog - db_host: "172.16.100.99" - db_port: 9007 - db_username: artuser # 后期需要修改 - db_password: "C250PflXIWv2SQm8" # 后期需要修改 when: status: [ failure, success ] - branch: dev + branch: dev1 network: - subnet: 172.18.0.0/16 + subnet: dnmp_default trigger: branch: - dev From c44ea83b6cd82d5dd0f2012c313d59db0d6a7ac6 Mon Sep 17 00:00:00 2001 From: daiyb <570956418@qq.com> Date: Fri, 17 Oct 2025 14:04:09 +0800 Subject: [PATCH 2/2] Update .drone.yml --- .drone.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.drone.yml b/.drone.yml index 2f80d86..def2b56 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,6 +11,8 @@ volumes: - name: docker-daemon host: path: /etc/docker/daemon.json +clone: + disable: true steps: - name: clone-and-configure image: testhub.szjixun.cn:9043/public/plugins/git @@ -54,6 +56,7 @@ steps: path: /go/pkg commands: - cp DockerfileTest Dockerfile + - go mod tidy - CGO_ENABLED=0 go build -ldflags "-s -w" -o chain-dci-server ./cmd - name: publish image: testhub.szjixun.cn:9043/public/plugins/docker