Browse Source

测试ci

master
wally 4 years ago
parent
commit
e9eebb39b4
  1. 148
      .drone.yml

148
.drone.yml

@ -1,7 +1,7 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: test name: development
# 挂载的主机卷,可以映射到docker容器中 # 挂载的主机卷,可以映射到docker容器中
volumes: volumes:
@ -60,44 +60,103 @@ steps:
username: root username: root
key_path: /root/.ssh/id_rsa key_path: /root/.ssh/id_rsa
rm: true # true则会删除目标目录重建 rm: true # true则会删除目标目录重建
target: /home/check-work target: /home/checkwork
source: dist/* source: dist/*
strip_components: 1 # 去除的目录层数,如果没有该选项,则拷贝过去是 target/xxx.jar,1代表去除target strip_components: 1 # 去除的目录层数,如果没有该选项,则拷贝过去是 target/xxx.jar,1代表去除target
# - name: run-ssh - name: notify-wechatwork
# image: appleboy/drone-ssh image: fifsky/drone-wechat-work
# pull: if-not-exists pull: if-not-exists
settings:
url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=428e5c5d-f992-4349-939d-9c99556e50b8
msgtype: markdown
content: |
{{if eq .Status "success" }}
#### 🎉 ${DRONE_REPO} 构建成功
> Commit: [${DRONE_COMMIT_MESSAGE}](${DRONE_COMMIT_LINK})
> Author: ${DRONE_COMMIT_AUTHOR}
> [点击查看](${DRONE_BUILD_LINK})
{{else}}
#### ❌ ${DRONE_REPO} 构建失败
> Commit: [${DRONE_COMMIT_MESSAGE}](${DRONE_COMMIT_LINK})
> Author: ${DRONE_COMMIT_AUTHOR}
> 请立即修复!!!
> [点击查看](${DRONE_BUILD_LINK})
{{end}}
when:
status:
- failure
- success
trigger:
branch:
- develop
---
kind: pipeline
type: docker
name: production
# 挂载的主机卷,可以映射到docker容器中
volumes:
# maven构建缓存(宿主机目录)
- name: ssh_key
host:
path: /root/.ssh/
- name: cache
host:
path: /var/lib/cache
- name: data
host:
path: /var/lib/data
steps:
# - name: restore-cache
# image: drillster/drone-volume-cache
# volumes: # volumes:
# - name: ssh_key # - name: cache
# path: /root/.ssh/ # path: /cache
# settings: # settings:
# settings: # restore: true
# host: test.tall.wiki # mount:
# port: 22 # - ./node_modules
# username: root
# key_path: /root/.ssh/id_rsa - name: build
# script_stop: true # stop script after first failure image: node
# #command_timeout: 30s # 30seconds, the maximum amount of time for the execute commands, default is 10 minutes. pull: if-not-exists # default always
# script: # volumes:
# - cd /home/iacd-platform-drone # - name: cache
# - ./re.sh > /dev/null 2> /dev/null & # path: /root/.m2
commands:
- npm config set registry http://registry.npm.taobao.org
- npm i
- npm run test
# - name: notify-email # - name: rebuild-cache
# image: drillster/drone-email # image: drillster/drone-volume-cache
# pull: if-not-exists # volumes:
# - name: cache
# path: /cache
# settings: # settings:
# host: smtp.qiye.aliyun.com #例如 smtp.qq.com # rebuild: true
# port: 465 #例如QQ邮箱端口465 # mount:
# username: devops@ccsens.com #邮箱用户名 # - ./node_modules
# password: #邮箱密码
# from_secret: orgsecret_password_mail_devops - name: deploy-scp
# from: devops@ccsens.com image: appleboy/drone-scp
# recipients: weizezhao@ccsens.com #收件人,多个用,隔开 pull: if-not-exists
# when: #执行条件 volumes:
# status: - name: ssh_key
# - success path: /root/.ssh/
# - changed settings:
# - failure host: www.tall.wiki
port: 22
username: root
key_path: /root/.ssh/id_rsa
rm: true # true则会删除目标目录重建
target: /home/checkwork
source: dist/*
strip_components: 1 # 去除的目录层数,如果没有该选项,则拷贝过去是 target/xxx.jar,1代表去除target
- name: notify-wechatwork - name: notify-wechatwork
image: fifsky/drone-wechat-work image: fifsky/drone-wechat-work
@ -124,26 +183,5 @@ steps:
- success - success
trigger: trigger:
branch: develop branch:
# - name: notify-dingtalk - master
# image: lddsb/drone-dingtalk-message
# environment:
# PASSWORD:
# from_secret: password_mail_devops
# settings:
# token: your-dingtalk-robot-access-token
# type: markdown
# message_color: true
# message_pic: true
# sha_link: true
# -name: notify-slack
# image: plugins/slack
# webhook: https://hooks.slack.com/ www.dijiuyy.com services/xxx/xxx/xxx
# channel: dev
# template: >
# {{#success build.status}}
# build {{build.number}} succeeded. Good job.
# {{else}}
# build {{build.number}} failed. Fix me please.
# {{/success}}

Loading…
Cancel
Save