drone.template.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. kind: pipeline
  2. type: kubernetes
  3. name: [APP]
  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 $DRONE_GIT_HTTP_URL .
  13. - name: deployment
  14. image: hub.evbj.easou.com/dev/drone-agent:v3.0.1-230506
  15. pull: always
  16. # privileged: true
  17. environment:
  18. JNLP_ENV: [ENV]
  19. JNLP_REPLICAS: [REPLICA]
  20. JNLP_TAG: [TAG]
  21. JNLP_VERSION: v1 # default v1, v2 for canary
  22. DEPLOY_ENV: k8s-1 # 可以选择把应用部署到集群:k8s-1 or k8s-2
  23. JNLP_REPO: hub.evbj.easou.com
  24. JNLP_CONTAINER_PORT: 80
  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: 30
  33. JNLP_LIVENESS_PER: 15
  34. JNLP_READINESS_INIT: 30
  35. JNLP_READINESS_PER: 15
  36. JNLP_INGRESS_PUB: [EXPOSE]
  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. # 添加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