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.

64 lines
2.0 KiB

3 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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:1.17-alpine3.15
  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: [ "test","pre" ]
  22. - name: docker-build
  23. image: plugins/docker
  24. privileged: true
  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: [ "test","pre" ]
  34. # - name: rancher-push
  35. # privileged: true
  36. # image: registry.cn-hangzhou.aliyuncs.com/hvp/dpr:55 # 直接用busybox
  37. # settings:
  38. ## docker_img : registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  39. # tar : test-drone-${DRONE_BUILD_NUMBER}.tar
  40. # commands:
  41. # - podman ps
  42. # - docker login --username=tjqmhu -p "tjqm4912" registry.cn-hangzhou.aliyuncs.com
  43. # - docker pull registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  44. # - docker save registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} >test-drone-${DRONE_BUILD_NUMBER}.tar
  45. # when:
  46. # target: [ "test","pre" ]
  47. - name: rancher-deploy
  48. privileged: true
  49. image: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  50. settings:
  51. tar : test-drone-${DRONE_BUILD_NUMBER}.tar
  52. commands:
  53. - docker login --username=tjqmhu -p "tjqm4912" registry.cn-hangzhou.aliyuncs.com
  54. - docker pull registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER}
  55. - docker save registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone:${DRONE_BUILD_NUMBER} >test-drone-${DRONE_BUILD_NUMBER}.tar
  56. - dpr
  57. when:
  58. target: ["pre"]