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.

85 lines
3.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. ---
  2. kind: pipeline
  3. type: docker
  4. name: default
  5. volumes:
  6. - name: gopath
  7. host:
  8. path: /usr/local/path/gopath
  9. steps:
  10. # - name: golang-build
  11. # image: golang
  12. # volumes:
  13. # - name: gopath
  14. # path: /go
  15. # commands:
  16. # - export GOPROXY=https://goproxy.cn
  17. # - go mod init test-drone
  18. # - go mod tidy
  19. # - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-drone
  20. # when:
  21. # target: [ "" ]
  22. #
  23. # - name: docker-push
  24. # image: plugins/docker
  25. # settings:
  26. # username: tjqmhu
  27. # password: tjqm4912
  28. # repo: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone
  29. # dockerfile: Dockerfile
  30. # registry: https://registry.cn-hangzhou.aliyuncs.com
  31. # tags: ${DRONE_BUILD_NUMBER}
  32. # when:
  33. # target: [ "" ]
  34. - name: rancher-deploy
  35. # drone-rancher插件,利用此插件来启动rancher
  36. image: pelotech/drone-rancher
  37. settings:
  38. # rancher-server地址
  39. url: '121.40.194.123:8082'
  40. access_key: token-qqrhk
  41. secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  42. service: default/drone-test
  43. # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库
  44. docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
  45. # - name: rancher-deploy
  46. # image: peloton/drone-rancher
  47. # url: https://121.40.194.123:8443/
  48. # access_key: token-qqrhk
  49. # secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  50. # service: default/drone-test
  51. # # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库
  52. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
  53. # start_first: true # 先启动新服务, 后停止原服务. 如果为false则先关闭原服务再启动
  54. # confirm: true
  55. # timeout: 100 # 如果rancher没在这个时间内升级成功则报错, 服务大小等差异会导致升级时间不一样, 可根据自己业务修改超时时间.
  56. # image: pelotech/drone-rancher # drone-rancher插件,利用此插件来启动rancher
  57. # settings:
  58. # url: 'http://121.40.194.123:8082/v3'
  59. # access_key: token-qqrhk
  60. # secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  61. # service: registry.cn-hangzhou.aliyuncs.com
  62. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
  63. # start_first: false
  64. # confirm: true
  65. # timeout: 301
  66. # ## 使用参数推送稳定镜像
  67. # - name: deployment-replace-prod
  68. # image: repository.241210.com/repository/base/kubectl:4
  69. # commands:
  70. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  71. # when:
  72. # target: [ "pre","prod" ]
  73. #
  74. # - name: deploy-prod
  75. # image: repository.241210.com/repository/base/kubectl:4
  76. # commands:
  77. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  78. # when:
  79. # target: [ "pre","prod" ]