From c64ca0cb9402b61c1183caa79cd8628b63fa8aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E6=AD=A6?= <875892894@qq.com> Date: Thu, 1 Aug 2024 00:07:49 +0800 Subject: [PATCH] test --- .drone.yml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..bfaff3d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,81 @@ +workspace: + base: /project + path: src/demo + +branches: [ master,develop,uat ] + + +pipeline: + + build: + image: golang:alpine + commands: + - export GO111MODULE=on + - export GOPROXY=https://goproxy.cn,direct + - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server.app + + docker-dev: + image: plugins/docker + repo: registry.cn-shenzhen.aliyuncs.com/ax-stor/ax-bkb-seller + registry: registry.cn-shenzhen.aliyuncs.com + use_cache: true + dockerfile: Dockerfile + secrets: [ docker_username, docker_password ] + tags: latest + when: + branch: develop + + docker-uat: + image: plugins/docker + repo: registry.cn-shenzhen.aliyuncs.com/ax-stor/ax-bkb-seller + registry: registry.cn-shenzhen.aliyuncs.com + use_cache: true + dockerfile: Dockerfile + secrets: [ docker_username, docker_password ] + tags: latest + when: + branch: uat + + docker-prod: + image: plugins/docker + repo: registry.cn-shenzhen.aliyuncs.com/ax-stor/ax-bkb-seller + registry: registry.cn-shenzhen.aliyuncs.com + use_cache: true + dockerfile: Dockerfile + secrets: [ docker_username, docker_password ] + tags: v1.0.0 + when: + branch: master + # deploy: + # image: helm:v2.8.1 + # commands: + # - mkdir -p /root/.kube && cp -r .kube/config /root/.kube + # - helm delete drone-go-demo --purge || true + # - helm install --name drone-go-demo --set image.tag=${DRONE_TAG=latest} Chart + + deploy-dev: + image: roffe/kubectl + commands: + - rm -rf /root/.kube && cp -r .kube /root + - kubectl delete -f deployDev.yaml || true + - kubectl apply -f deployDev.yaml + when: + branch: develop + + deploy-uat: + image: roffe/kubectl + commands: + - rm -rf /root/.kube && cp -r .kube /root + - kubectl delete -f deployUat.yaml || true + - kubectl apply -f deployUat.yaml + when: + branch: uat + + deploy-prod: + image: roffe/kubectl + commands: + - rm -rf /root/.kube && cp -r .kube /root + # - kubectl delete -f deployment.yaml || true + - kubectl apply -f deployment.yaml --record + when: + branch: master \ No newline at end of file