fix
parent
b312dcd929
commit
df0f467ea8
@ -1,120 +1,119 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
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
|
||||
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
|
||||
path: /cache
|
||||
|
||||
# build
|
||||
- name: build
|
||||
pull: if-not-exists
|
||||
image: node:14.16.1
|
||||
commands:
|
||||
- npm run build
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
branch: [development, test, master, sso]
|
||||
|
||||
# docker-build
|
||||
- name: docker-build
|
||||
pull: if-not-exists
|
||||
image: plugins/docker
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
settings:
|
||||
repo: hub.kaiguawang.cn/longge/visitor-node-api
|
||||
registry: hub.kaiguawang.cn
|
||||
tags:
|
||||
- latest
|
||||
- '0.0.1'
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
branch: [development, test, master]
|
||||
|
||||
# run
|
||||
- name: dev-run
|
||||
image: appleboy/drone-ssh
|
||||
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
|
||||
|
||||
path: /cache
|
||||
|
||||
# build
|
||||
- name: build
|
||||
pull: if-not-exists
|
||||
image: node:14.16.1
|
||||
commands:
|
||||
- npm run build
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
branch: [development, test, master, sso]
|
||||
|
||||
# docker-build
|
||||
- name: docker-build
|
||||
pull: if-not-exists
|
||||
image: plugins/docker
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
settings:
|
||||
repo: hub.kaiguawang.cn/longge/visitor-node-api
|
||||
registry: hub.kaiguawang.cn
|
||||
tags:
|
||||
- latest
|
||||
- '0.0.1'
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
branch: [development, test, master]
|
||||
|
||||
# run
|
||||
- name: dev-run
|
||||
image: appleboy/drone-ssh
|
||||
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