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.

63 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 GOPRIVATE=gitea.241210.com
  17. - export GOPROXY=https://goproxy.cn
  18. - go mod init test-drone
  19. - go mod tidy
  20. - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-drone
  21. when:
  22. target: [ "" ]
  23. # - name: docker-push
  24. # image: plugins/docker
  25. # settings:
  26. # username: docker-push
  27. # password: WeWlh6hGYCtxO4r
  28. # repo: repository.241210.com/repository/gyys/drone/test-drone
  29. # dockerfile: Dockerfile
  30. # registry: https://repository.241210.com
  31. # tags: ${DRONE_BUILD_NUMBER}
  32. # when:
  33. # target: [ "" ]
  34. #
  35. # - name: deployment-replace
  36. # image: repository.241210.com/repository/base/kubectl:4
  37. # commands:
  38. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  39. # when:
  40. # target: [ "develop","test" ]
  41. #
  42. # - name: deploy
  43. # image: repository.241210.com/repository/base/kubectl:4
  44. # commands:
  45. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET:-develop} apply -f deployment.yaml
  46. # when:
  47. # target: [ "develop","test" ]
  48. # ## 使用参数推送稳定镜像
  49. # - name: deployment-replace-prod
  50. # image: repository.241210.com/repository/base/kubectl:4
  51. # commands:
  52. # - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  53. # when:
  54. # target: [ "pre","prod" ]
  55. #
  56. # - name: deploy-prod
  57. # image: repository.241210.com/repository/base/kubectl:4
  58. # commands:
  59. # - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  60. # when:
  61. # target: [ "pre","prod" ]