scofield 4 tahun lalu
induk
melakukan
7de7ccdfde
1 mengubah file dengan 37 tambahan dan 16 penghapusan
  1. 37 16
      .drone.yml

+ 37 - 16
.drone.yml

@@ -1,18 +1,40 @@
----
 kind: pipeline
+type: kubernetes
 name: book-touchrs-base
 
+clone:
+  disable: true
+
+metadata:
+  namespace: drone
+
 steps:
+ - name: clone
+   image: hub.evbj.easou.com/dev/alpine-git:20200622
+   commands:
+   - git clone $DRONE_GIT_HTTP_URL .
+
  - name: build
-   image: hub.evbj.easou.com/dev/drone-agent-custom:v6.0.0
-  #  pull: always
-   privileged: true
+   image: plugins/docker
+   settings:
+     username: admin
+     password: Easou2)1*
+     insecure: true
+     mirror: https://ci7pm4nx.mirror.aliyuncs.com
+     registry: hub.evbj.easou.com
+     repo: hub.evbj.easou.com/pro/${DRONE_REPO_NAME}
+     tag: v2.1.1
+     
+ - name: deployment
+   image: hub.evbj.easou.com/dev/drone-agent:v2.0.0
+   pull: always
+   # privileged: true
    environment:
      JNLP_ENV: pro
      JNLP_REPLICAS: 4
      JNLP_TAG: v2.1.1
-     #JNLP_TAG: v2test2
-     JNLP_VERSION: v1  #default v1, canary for v2
+     JNLP_VERSION: v1  # default v1, v2 for canary
+     DEPLOY_ENV: k8s-1 # 可以选择把应用部署到集群:k8s-1 or k8s-2
      JNLP_REPO: hub.evbj.easou.com
      JNLP_CONTAINER_PORT: 8080
      JNLP_INGRESS: nginx
@@ -27,20 +49,19 @@ steps:
      JNLP_READINESS_INIT: 90
      JNLP_READINESS_PER: 15
    commands:
-     - wrapper.sh  /bin/sh
-     - docker --config /etc/docker build -t "$JNLP_REPO/$JNLP_ENV/$DRONE_REPO_NAME:$JNLP_TAG" . -f Dockerfile
-     - docker --config /etc/docker push "$JNLP_REPO/$JNLP_ENV/$DRONE_REPO_NAME:$JNLP_TAG"
+     # 切换目标集群
+     - kubecm s $DEPLOY_ENV
      # 生成配置YAML文件
-     - python tools.py -b
-     # 调用kubectl部署服务到kubernetes上
-     - python tools.py -a
+     - python3 /root/tools.py -b
+     # 部署服务到kubernetes上
+     - python3 /root/tools.py -a
      # 检查服务部署状态
-     - python tools.py -c
+     - python3 /root/tools.py -c
      # 添加dns解析记录,生成访问域名
-     - python tools.py -d
+     - python3 /root/tools.py -d
 
  - name: success
-   image: clem109/drone-wechat
+   image: hub.evbj.easou.com/dev/drone-wechat:20200622
    settings:
      corpid: ww419ee4063735e1c0
      corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
@@ -54,7 +75,7 @@ steps:
      - success
 
  - name: failure
-   image: clem109/drone-wechat
+   image: hub.evbj.easou.com/dev/drone-wechat:20200622
    settings:
      corpid: ww419ee4063735e1c0
      corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M