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.
88 lines
2.6 KiB
88 lines
2.6 KiB
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
volumes:
|
|
- name: gopath
|
|
host:
|
|
path: /usr/local/path/gopath
|
|
|
|
steps:
|
|
- name: code-analysis
|
|
image: aosapps/drone-sonar-plugin
|
|
settings:
|
|
sonar_host: http://192.168.1.252:19000
|
|
sonar_token: c38d5625bfd0c9027cbb54ddb80968d6b7601733
|
|
when:
|
|
target: ["develop","test","pre"]
|
|
|
|
- name: golang-build
|
|
image: golang
|
|
volumes:
|
|
- name: gopath
|
|
path: /go
|
|
commands:
|
|
- export GOPROXY=gitea.241210.com,mirrors.aliyun.com/goproxy/,gocenter.io,proxy.golang.org,goproxy.cn,gonexus.dev
|
|
- export GOPRIVATE=gitea.241210.com
|
|
- cd web/
|
|
# - export GOPROXY=https://gocenter.io
|
|
# - export GOPROXY=https://proxy.golang.org
|
|
# - export GOPROXY=https://goproxy.cn
|
|
# - export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
|
# - export GOPROXY=https://gonexus.dev
|
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gy-uuos-web
|
|
when:
|
|
target: ["develop","test","pre"]
|
|
|
|
- name: docker-push
|
|
image: plugins/docker
|
|
settings:
|
|
username: docker-push
|
|
password: WeWlh6hGYCtxO4r
|
|
repo: repository.241210.com/repository/gyys/drone/gy-uuos
|
|
dockerfile: web/Dockerfile
|
|
registry: https://repository.241210.com
|
|
tags: ${DRONE_BUILD_NUMBER}
|
|
when:
|
|
target: ["develop","test","pre"]
|
|
|
|
- name: deployment-replace
|
|
image: repository.241210.com/repository/base/kubectl:4
|
|
commands:
|
|
- cd web/
|
|
- sed -i 's!IMAGE_PATH:IMAGE_TAG!'repository.241210.com/repository/gyys/drone/gy-uuos:${DRONE_BUILD_NUMBER}'!g' deployment.yaml
|
|
when:
|
|
target: ["develop","test","pre"]
|
|
|
|
- name: deploy
|
|
image: repository.241210.com/repository/base/kubectl:4
|
|
commands:
|
|
- cd web/
|
|
- kubectl --kubeconfig /kube/${CI_BUILD_TARGET:-develop} apply -f deployment.yaml
|
|
when:
|
|
target: ["develop","test","pre"]
|
|
## 使用参数推送稳定镜像
|
|
- name: deployment-replace-prod
|
|
image: repository.241210.com/repository/base/kubectl:4
|
|
commands:
|
|
- cd web/
|
|
- sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
|
|
when:
|
|
target: ["exp","prod"]
|
|
|
|
- name: deploy-prod
|
|
image: repository.241210.com/repository/base/kubectl:4
|
|
commands:
|
|
- cd web/
|
|
- kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
|
|
when:
|
|
target: ["exp","prod"]
|
|
# - name: ding
|
|
# image: lddsb/drone-dingtalk-message
|
|
# settings:
|
|
# token: f09f64151159f9243e771503ae4a5ef5af3e079f6828b464c17ea2bb291523c2
|
|
# type: markdown
|
|
# sha_link: true
|
|
# when:
|
|
# status: [success, failure]
|