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.

52 lines
1.4 KiB

3 years ago
1 year 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. commands:
  32. # - docker build -t registry.cn-hangzhou.aliyuncs.com/hvp/dpr:7 .
  33. - docker save -o registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  34. when:
  35. target: [ "" ]
  36. - name: rancher-deploy
  37. image: registry.cn-hangzhou.aliyuncs.com/hvp/dpr:7 # 直接用busybox
  38. settings:
  39. url: https://121.40.194.123:8443/v3/
  40. env: test
  41. pname: test-drone
  42. docker_img : registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  43. #
  44. # - name: deploy-prod
  45. # image: repository.241210.com/repository/base/kubectl:4
  46. # commands:
  47. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  48. # when:
  49. # target: [ "pre","prod" ]