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.

93 lines
3.3 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
  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. - name: docker-push
  23. image: plugins/docker
  24. settings:
  25. username: tjqmhu
  26. password: tjqm4912
  27. repo: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone
  28. dockerfile: Dockerfile
  29. registry: https://registry.cn-hangzhou.aliyuncs.com
  30. tags: ${DRONE_BUILD_NUMBER}
  31. when:
  32. target: [ "" ]
  33. # - name: rancher-deploy
  34. # # drone-rancher插件,利用此插件来启动rancher
  35. # image: pelotech/drone-rancher
  36. # settings:
  37. # # rancher-server地址
  38. # url: 'https://121.40.194.123:8443'
  39. # access_key: token-qqrhk
  40. # secret_key: fwbzktwzs4kqf8p4pzsfn92thzms76vrglghh2khmdxkr6svm57796
  41. # service: pre/default
  42. # # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库
  43. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
  44. # - name: run
  45. # image: pelotech/drone-rancher
  46. # url: https://121.40.194.123:8443
  47. # access_key: token-j24z5
  48. # secret_key: fwbzktwzs4kqf8p4pzsfn92thzms76vrglghh2khmdxkr6svm57796
  49. # service: default/test-drone
  50. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:20
  51. # - name: rancher-deploy
  52. # image: peloton/drone-rancher
  53. # url: https://121.40.194.123:8443/
  54. # access_key: token-qqrhk
  55. # secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  56. # service: default/drone-test
  57. # # 为了使rancher能拉取到私有镜像, 需要在rancher控制面板"基础架构->镜像库"添加这个私有镜像库
  58. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
  59. # start_first: true # 先启动新服务, 后停止原服务. 如果为false则先关闭原服务再启动
  60. # confirm: true
  61. # timeout: 100 # 如果rancher没在这个时间内升级成功则报错, 服务大小等差异会导致升级时间不一样, 可根据自己业务修改超时时间.
  62. # image: pelotech/drone-rancher # drone-rancher插件,利用此插件来启动rancher
  63. # settings:
  64. # url: 'http://121.40.194.123:8082/v3'
  65. # access_key: token-qqrhk
  66. # secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  67. # service: registry.cn-hangzhou.aliyuncs.com
  68. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
  69. # start_first: false
  70. # confirm: true
  71. # timeout: 301
  72. # ## 使用参数推送稳定镜像
  73. # - name: deployment-replace-prod
  74. # image: repository.241210.com/repository/base/kubectl:4
  75. # commands:
  76. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  77. # when:
  78. # target: [ "pre","prod" ]
  79. #
  80. # - name: deploy-prod
  81. # image: repository.241210.com/repository/base/kubectl:4
  82. # commands:
  83. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  84. # when:
  85. # target: [ "pre","prod" ]