.drone.yml 2.1 KB

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