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.

67 lines
1.9 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
  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. image: dubc/drone-rancher-stack-v1
  35. url: https://121.40.194.123:8443/
  36. stack: app-staging
  37. accesskey: token-qqrhk
  38. secretkey: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  39. pull: true
  40. # image: pelotech/drone-rancher # drone-rancher插件,利用此插件来启动rancher
  41. # settings:
  42. # url: 'http://121.40.194.123:8082/v3'
  43. # access_key: token-qqrhk
  44. # secret_key: wt46cz8x8xqz5t7x27htzdc46tscvpnzwzlj9gp99j2cbdrqhtcj25
  45. # service: registry.cn-hangzhou.aliyuncs.com
  46. # docker_image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} # 镜像地址及版本号
  47. # start_first: false
  48. # confirm: true
  49. # timeout: 301
  50. # ## 使用参数推送稳定镜像
  51. # - name: deployment-replace-prod
  52. # image: repository.241210.com/repository/base/kubectl:4
  53. # commands:
  54. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  55. # when:
  56. # target: [ "pre","prod" ]
  57. #
  58. # - name: deploy-prod
  59. # image: repository.241210.com/repository/base/kubectl:4
  60. # commands:
  61. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  62. # when:
  63. # target: [ "pre","prod" ]