You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

6 months ago
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