kind: pipeline type: docker name: chain-dci【K8s-测试服】 volumes: - name: pkgdeps host: path: /mnt/data/drone/define_cache/chain-dci - name: docker host: path: /var/run/docker.sock - name: docker-daemon 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 environment: GOPROXY: "https://goproxy.cn,direct" GOPATH: /go GOCACHE: /go/pkg/mod/cache volumes: - name: pkgdeps 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 pull: if-not-exists volumes: - name: docker path: /var/run/docker.sock - name: pkgdeps path: /cache settings: purge: false username: from_secret: harbor22-name password: from_secret: harbor22-password registry: from_secret: harbor22-host repo: testhub.szjixun.cn:9043/k8stest/chain-dci-server tags: - latest - ${DRONE_BUILD_NUMBER} - name: Deploy app image: testhub.szjixun.cn:9043/public/drone-k8s:latest settings: debug: true build_number: ${DRONE_BUILD_NUMBER} kuboard_accessKey: p7by8secijpm.bipdt88e55c8me4szah2njpr5kie2yed namespace: "chain-server" deployment_name: "chain-dci-server" dashboard: kuboard build_repo: from_secret: build_repo - name: 钉钉通知 image: testhub.szjixun.cn:9043/public/drone-ding settings: token: from_secret: ding-token secret: from_secret: ding-secret type: markdown message_color: true message_pic: true sha_link: true db_log: true db_type: mysql db_name: notelog when: status: [ failure, success ] branch: dev1 network: subnet: dnmp_default trigger: branch: - dev event: - push - custom