.drone.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. kind: pipeline
  2. type: kubernetes
  3. name: duanju-miniprogram-api
  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-230506
  15. pull: always
  16. environment:
  17. JNLP_ENV: duanju
  18. #JNLP_REPLICAS: 2
  19. #JNLP_TAG: v3.0.0
  20. JNLP_VERSION: v1 # default v1, v2 for canary
  21. DEPLOY_ENV: k8s-1 # 可以选择把应用部署到集群:k8s-1(阿里云) or k8s-2(IDC机房)
  22. #JNLP_REPO: hub.evbj.easou.com
  23. #JNLP_CONTAINER_PORT: 8080
  24. JNLP_INGRESS: nginx
  25. #JNLP_SVC_MODE: http
  26. #JNLP_STORAGE_CLASS: rbd #k8s-2的STORAGE_CLASS为: rbd; k8s-1的STORAGE_CLASS为: ceph-block
  27. JNLP_DOMAIN: .ieasou.cn
  28. JNLP_CONTROL: StatefulSet
  29. #JNLP_STORAGE_CAPACITY: 200Gi
  30. #JNLP_MOUNT_PATH: /data
  31. JNLP_LIVENESS_INIT: 45
  32. JNLP_LIVENESS_PER: 15
  33. JNLP_READINESS_INIT: 45
  34. JNLP_READINESS_PER: 15
  35. JNLP_INGRESS_PUB: yes
  36. commands:
  37. # 切换目标集群
  38. - kubecm s $DEPLOY_ENV
  39. # 生成配置YAML文件
  40. # - python3 /root/tools.py -b
  41. # 部署服务到kubernetes上
  42. # - python3 /root/tools.py -a
  43. # apply for prod
  44. - kubectl apply -f deploy.yaml --record
  45. # apply for canary
  46. #- kubectl apply -f deploy-canary.yaml --record
  47. # 检查服务部署状态
  48. # - python3 /root/tools.py -c
  49. # 添加dns解析记录,生成访问域名
  50. #- python3 /root/tools.py -d
  51. - name: success
  52. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  53. settings:
  54. corpid: ww419ee4063735e1c0
  55. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  56. agent_id: 1000004
  57. title: "Pipeline ${DRONE_REPO_NAME} Success"
  58. description: "${DRONE_BUILD_LINK} 部署完成"
  59. msg_url: ${DRONE_BUILD_LINK}
  60. btn_txt: "否"
  61. when:
  62. status:
  63. - success
  64. - name: failure
  65. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  66. settings:
  67. corpid: ww419ee4063735e1c0
  68. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  69. agent_id: 1000004
  70. title: "Pipeline ${DRONE_REPO_NAME} Failure"
  71. description: "${DRONE_BUILD_LINK} 部署失败,请检查配置!"
  72. msg_url: ${DRONE_BUILD_LINK}
  73. btn_txt: "否"
  74. when:
  75. status:
  76. - failure