drone.template.yml 2.0 KB

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