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.

62 lines
1.7 KiB

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: docker-push
  26. # password: WeWlh6hGYCtxO4r
  27. # repo: repository.241210.com/repository/gyys/drone/test-drone
  28. # dockerfile: Dockerfile
  29. # registry: https://repository.241210.com
  30. # tags: ${DRONE_BUILD_NUMBER}
  31. # when:
  32. # target: [ "" ]
  33. #
  34. # - name: deployment-replace
  35. # image: repository.241210.com/repository/base/kubectl:4
  36. # commands:
  37. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  38. # when:
  39. # target: [ "develop","test" ]
  40. #
  41. # - name: deploy
  42. # image: repository.241210.com/repository/base/kubectl:4
  43. # commands:
  44. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET:-develop} apply -f deployment.yaml
  45. # when:
  46. # target: [ "develop","test" ]
  47. # ## 使用参数推送稳定镜像
  48. # - name: deployment-replace-prod
  49. # image: repository.241210.com/repository/base/kubectl:4
  50. # commands:
  51. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  52. # when:
  53. # target: [ "pre","prod" ]
  54. #
  55. # - name: deploy-prod
  56. # image: repository.241210.com/repository/base/kubectl:4
  57. # commands:
  58. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  59. # when:
  60. # target: [ "pre","prod" ]