fix
parent
b312dcd929
commit
df0f467ea8
@ -1,120 +1,119 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
host:
|
host:
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
- name: cache
|
||||||
|
host: ·
|
||||||
|
path: /tmp/cache/visitor-new-api
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: restore-cache
|
||||||
|
pull: if-not-exists
|
||||||
|
image: drillster/drone-volume-cache
|
||||||
|
settings:
|
||||||
|
restore: true
|
||||||
|
mount:
|
||||||
|
- ./.npm-cache
|
||||||
|
- ./node_modules
|
||||||
|
volumes:
|
||||||
|
- name: cache
|
||||||
|
path: /cache
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
image: node:14.16.1
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
# 删除文件 npm install
|
||||||
|
# - rm -rf package-lock.json
|
||||||
|
- npm --registry https://registry.npm.taobao.org install
|
||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
branch: [development, test, master, sso]
|
||||||
|
|
||||||
|
- name: rebuild-cache
|
||||||
|
pull: if-not-exists
|
||||||
|
image: drillster/drone-volume-cache
|
||||||
|
settings:
|
||||||
|
rebuild: true
|
||||||
|
mount:
|
||||||
|
- ./.npm-cache
|
||||||
|
- ./node_modules
|
||||||
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
host: ·
|
path: /cache
|
||||||
path: /tmp/cache/visitor-new-api
|
|
||||||
|
# build
|
||||||
steps:
|
- name: build
|
||||||
- name: restore-cache
|
pull: if-not-exists
|
||||||
pull: if-not-exists
|
image: node:14.16.1
|
||||||
image: drillster/drone-volume-cache
|
commands:
|
||||||
settings:
|
- npm run build
|
||||||
restore: true
|
when:
|
||||||
mount:
|
event: [push, pull_request]
|
||||||
- ./.npm-cache
|
branch: [development, test, master, sso]
|
||||||
- ./node_modules
|
|
||||||
volumes:
|
# docker-build
|
||||||
- name: cache
|
- name: docker-build
|
||||||
path: /cache
|
pull: if-not-exists
|
||||||
|
image: plugins/docker
|
||||||
- name: install
|
volumes:
|
||||||
image: node:14.16.1
|
- name: dockersock
|
||||||
pull: if-not-exists
|
path: /var/run/docker.sock
|
||||||
commands:
|
settings:
|
||||||
# 删除文件 npm install
|
repo: hub.kaiguawang.cn/longge/visitor-node-api
|
||||||
# - rm -rf package-lock.json
|
registry: hub.kaiguawang.cn
|
||||||
- npm --registry https://registry.npm.taobao.org install
|
tags:
|
||||||
when:
|
- latest
|
||||||
event: [push, pull_request]
|
- '0.0.1'
|
||||||
branch: [development, test, master, sso]
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
- name: rebuild-cache
|
password:
|
||||||
pull: if-not-exists
|
from_secret: docker_password
|
||||||
image: drillster/drone-volume-cache
|
when:
|
||||||
settings:
|
event: [push, pull_request]
|
||||||
rebuild: true
|
branch: [development, test, master]
|
||||||
mount:
|
|
||||||
- ./.npm-cache
|
# run
|
||||||
- ./node_modules
|
- name: dev-run
|
||||||
volumes:
|
image: appleboy/drone-ssh
|
||||||
- name: cache
|
pull: if-not-exists
|
||||||
path: /cache
|
settings:
|
||||||
|
host: 172.17.0.1
|
||||||
# build
|
username: root
|
||||||
- name: build
|
password:
|
||||||
pull: if-not-exists
|
from_secret: ssh_password
|
||||||
image: node:14.16.1
|
port: 22
|
||||||
commands:
|
command_timeout: 300s
|
||||||
- npm run build
|
script:
|
||||||
when:
|
- cd /home/runtime/apps/qunsense
|
||||||
event: [push, pull_request]
|
- docker compose up -d api
|
||||||
branch: [development, test, master, sso]
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
# docker-build
|
branch: [development]
|
||||||
- name: docker-build
|
|
||||||
pull: if-not-exists
|
- name: notify
|
||||||
image: plugins/docker
|
image: fifsky/drone-wechat-work
|
||||||
volumes:
|
pull: if-not-exists
|
||||||
- name: dockersock
|
# pull: always
|
||||||
path: /var/run/docker.sock
|
settings:
|
||||||
settings:
|
url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4166884e-9d7b-4e7a-a1c8-80d71d4755ba
|
||||||
repo: hub.kaiguawang.cn/longge/visitor-node-api
|
msgtype: markdown
|
||||||
registry: hub.kaiguawang.cn
|
content: |
|
||||||
tags:
|
{{if eq .Status "success" }}
|
||||||
- latest
|
#### 🎉 ${DRONE_REPO} 构建成功
|
||||||
- '0.0.1'
|
> Commit: ${DRONE_COMMIT_MESSAGE}
|
||||||
username:
|
> Author: ${DRONE_COMMIT_AUTHOR}
|
||||||
from_secret: docker_username
|
{{else}}
|
||||||
password:
|
#### ❌ ${DRONE_REPO} 构建失败
|
||||||
from_secret: docker_password
|
> Commit: ${DRONE_COMMIT_MESSAGE}
|
||||||
when:
|
> Author: ${DRONE_COMMIT_AUTHOR}
|
||||||
event: [push, pull_request]
|
> 请立即修复!!!
|
||||||
branch: [development, test, master]
|
{{end}}
|
||||||
|
when:
|
||||||
# run
|
status:
|
||||||
- name: dev-run
|
- failure
|
||||||
image: appleboy/drone-ssh
|
- success
|
||||||
pull: if-not-exists
|
|
||||||
settings:
|
|
||||||
host: 172.17.0.1
|
|
||||||
username: root
|
|
||||||
password:
|
|
||||||
from_secret: ssh_password
|
|
||||||
port: 22
|
|
||||||
command_timeout: 300s
|
|
||||||
script:
|
|
||||||
- cd /home/runtime/apps/qunsense
|
|
||||||
- docker compose up -d api
|
|
||||||
when:
|
|
||||||
event: [push, pull_request]
|
|
||||||
branch: [development]
|
|
||||||
|
|
||||||
- name: notify
|
|
||||||
image: fifsky/drone-wechat-work
|
|
||||||
pull: if-not-exists
|
|
||||||
# pull: always
|
|
||||||
settings:
|
|
||||||
url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4166884e-9d7b-4e7a-a1c8-80d71d4755ba
|
|
||||||
msgtype: markdown
|
|
||||||
content: |
|
|
||||||
{{if eq .Status "success" }}
|
|
||||||
#### 🎉 ${DRONE_REPO} 构建成功
|
|
||||||
> Commit: ${DRONE_COMMIT_MESSAGE}
|
|
||||||
> Author: ${DRONE_COMMIT_AUTHOR}
|
|
||||||
{{else}}
|
|
||||||
#### ❌ ${DRONE_REPO} 构建失败
|
|
||||||
> Commit: ${DRONE_COMMIT_MESSAGE}
|
|
||||||
> Author: ${DRONE_COMMIT_AUTHOR}
|
|
||||||
> 请立即修复!!!
|
|
||||||
{{end}}
|
|
||||||
when:
|
|
||||||
status:
|
|
||||||
- failure
|
|
||||||
- success
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue