drone.template.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. kind: pipeline
  2. type: kubernetes
  3. name: [APP]
  4. clone:
  5. disable: true
  6. metadata:
  7. namespace: drone
  8. steps:
  9. - name: clone
  10. image: hub.evbj.easou.com/dev/alpine-git:20200622
  11. commands:
  12. - git clone $DRONE_GIT_HTTP_URL .
  13. - name: build
  14. image: plugins/docker
  15. settings:
  16. username: admin
  17. password: Easou2)1*
  18. insecure: true
  19. mirror: https://ci7pm4nx.mirror.aliyuncs.com
  20. registry: hub.evbj.easou.com
  21. repo: hub.evbj.easou.com/[ENV]/[APP]
  22. tag: [TAG]
  23. # build_args:
  24. # - JAR_FILE=[JAR_FILE]
  25. # - SERVER_PORT=8080
  26. - name: deployment
  27. image: hub.evbj.easou.com/dev/drone-agent:v2.0.0
  28. pull: always
  29. # privileged: true
  30. environment:
  31. JNLP_ENV: [ENV]
  32. JNLP_REPLICAS: [REPLICA]
  33. JNLP_TAG: [TAG]
  34. JNLP_VERSION: v1 # default v1, v2 for canary
  35. DEPLOY_ENV: k8s-2 # 可以选择把应用部署到集群:k8s-1 or k8s-2
  36. JNLP_REPO: hub.evbj.easou.com
  37. JNLP_CONTAINER_PORT: 80
  38. JNLP_INGRESS: nginx
  39. JNLP_SVC_MODE: http
  40. JNLP_STORAGE_CLASS: rbd
  41. JNLP_DOMAIN: .ieasou.cn
  42. JNLP_CONTROL: StatefulSet
  43. JNLP_STORAGE_CAPACITY: 100Gi
  44. JNLP_MOUNT_PATH: /data
  45. JNLP_LIVENESS_INIT: 30
  46. JNLP_LIVENESS_PER: 15
  47. JNLP_READINESS_INIT: 30
  48. JNLP_READINESS_PER: 15
  49. commands:
  50. # 切换目标集群
  51. - kubecm s $DEPLOY_ENV
  52. # 生成配置YAML文件
  53. - python3 /root/tools.py -b
  54. # 部署服务到kubernetes上
  55. - python3 /root/tools.py -a
  56. # 检查服务部署状态
  57. - python3 /root/tools.py -c
  58. # 添加dns解析记录,生成访问域名
  59. - python3 /root/tools.py -d
  60. - name: success
  61. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  62. settings:
  63. corpid: ww419ee4063735e1c0
  64. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  65. agent_id: 1000004
  66. title: "Pipeline [ENV]/[APP]:[TAG] Success"
  67. description: "${DRONE_BUILD_LINK} [ENV]/[APP]:[TAG] 部署完成"
  68. msg_url: ${DRONE_BUILD_LINK}
  69. btn_txt: "否"
  70. when:
  71. status:
  72. - success
  73. - name: failure
  74. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  75. settings:
  76. corpid: ww419ee4063735e1c0
  77. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  78. agent_id: 1000004
  79. title: "Pipeline [ENV]/[APP]:[TAG] Failure"
  80. description: "${DRONE_BUILD_LINK} 部署失败,请检查配置!"
  81. msg_url: ${DRONE_BUILD_LINK}
  82. btn_txt: "否"
  83. when:
  84. status:
  85. - failure