.drone.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. kind: pipeline
  2. type: kubernetes
  3. name: book-webview
  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 --depth=1 $DRONE_GIT_HTTP_URL .
  13. - name: deployment
  14. image: hub.evbj.easou.com/dev/drone-agent:v3.0.1
  15. pull: always
  16. environment:
  17. JNLP_ENV: book-webview
  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. - pwd && ls -l
  44. # apply for prod
  45. #- kubectl apply -f deploy.yaml --record
  46. # apply for canary
  47. - kubectl apply -f deploy-canary.yaml --record
  48. # 检查服务部署状态
  49. # - python3 /root/tools.py -c
  50. # 添加dns解析记录,生成访问域名
  51. - python3 /root/tools.py -d
  52. - name: success
  53. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  54. settings:
  55. corpid: ww419ee4063735e1c0
  56. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  57. agent_id: 1000004
  58. title: "Pipeline ${DRONE_REPO_NAME} Success"
  59. description: "${DRONE_BUILD_LINK} 部署完成"
  60. msg_url: ${DRONE_BUILD_LINK}
  61. btn_txt: "否"
  62. when:
  63. status:
  64. - success
  65. - name: failure
  66. image: hub.evbj.easou.com/dev/drone-wechat:20200622
  67. settings:
  68. corpid: ww419ee4063735e1c0
  69. corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
  70. agent_id: 1000004
  71. title: "Pipeline ${DRONE_REPO_NAME} Failure"
  72. description: "${DRONE_BUILD_LINK} 部署失败,请检查配置!"
  73. msg_url: ${DRONE_BUILD_LINK}
  74. btn_txt: "否"
  75. when:
  76. status:
  77. - failure