ece.suwa3d.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

284 lines
6.0 KiB

#change 03.28
kind: pipeline
type: exec
name: git
clone:
disable: true
steps:
- name: clone
commands:
- cd /data/projects/${DRONE_REPO_NAME}
- git checkout ./components.d.ts
- git checkout ${DRONE_BRANCH}
- git pull
---
kind: pipeline
type: docker
name: build
clone:
disable: true
steps:
- name: yarn build prod
image: node:22.16.0
volumes:
- name: data
path: /data
environment:
HTTP_PROXY:
from_secret: http_proxy
HTTPS_PROXY:
from_secret: https_proxy
commands:
- cd /data
- env | grep -i http
- npm config set registry https://registry.npmmirror.com
- yarn
- yarn build
- chmod -R 777 dist
when:
event:
- promote
target:
- prod
- sruid
- name: yarn build test
image: node:22.16.0
environment:
HTTP_PROXY:
from_secret: http_proxy
HTTPS_PROXY:
from_secret: https_proxy
volumes:
- name: data
path: /data
commands:
- cd /data
- env | grep -i http
- npm config set registry https://registry.npmmirror.com
- yarn
- yarn build
- chmod -R 777 dist
when:
event:
- promote
target:
- test
volumes:
- name: web
host:
path: /data/projects/web.suwa3d.com
- name: modules
host:
path: /data/projects/node_modules
- name: data
host:
path: /data/projects/${DRONE_REPO_NAME}
depends_on:
- git
---
kind: pipeline
type: exec
name: zip_file
clone:
disable: true
steps:
- name: zip ${DRONE_REPO_NAME}
commands:
- cd /data/projects/${DRONE_REPO_NAME}/dist
- zip -vrm dist.zip ./
when:
event:
- promote
target:
- prod
- name: scp to dev
commands:
- cd /data/projects/${drone_repo_name}/dist
- scp -r ./* api@172.31.1.254:/home/api/deploy/web.api.suwa3d.com_28499/static/
when:
event:
- promote
target:
- test
depends_on:
- build
---
kind: pipeline
type: docker
name: upload
clone:
disable: true
steps:
#=============================== suwa3d ===================
- name: upload to oss
commands:
- python3 /home/devops/python_script/aliyun/upload.py
pull: never
image: oss2:latest
volumes:
- name: files
path: /files
- name: scripts
path: /scripts
commands:
- python3 /scripts/oss.py ${DRONE_REPO_NAME} backup
- python3 /scripts/oss.py ${DRONE_REPO_NAME} upload
when:
event:
- promote
target:
- prod
- name: restore to oss
pull: never
image: oss2:latest
volumes:
- name: files
path: /files
- name: scripts
path: /scripts
commands:
- python3 /scripts/oss.py ${DRONE_REPO_NAME} restore
when:
event:
- rollback
target:
- prod
- name: flush cdn
pull: never
image: oss2:latest
volumes:
- name: files
path: /files
- name: scripts
path: /scripts
commands:
- sleep 3
- echo https://${DRONE_REPO_NAME}/ > /scripts/${DRONE_REPO_NAME}
- cd /scripts && python3 /scripts/refresh.py -r ${DRONE_REPO_NAME} -t clear
when:
event:
- promote
- rollback
target:
- prod
#================================= oem ==========================
# - name: upload to oem oss
# commands:
# - python3 /home/devops/python_script/aliyun/upload.py
# pull: never
# image: oss2:latest
# volumes:
# - name: files
# path: /files
# - name: scripts
# path: /scripts
# commands:
# - python3 /scripts/oss.py oem-${DRONE_REPO_NAME} backup
# - python3 /scripts/oss.py oem-${DRONE_REPO_NAME} upload
# when:
# event:
# - promote
# target:
# - oem
# - name: restore to oem oss
# pull: never
# image: oss2:latest
# volumes:
# - name: files
# path: /files
# - name: scripts
# path: /scripts
# commands:
# - python3 /scripts/oss.py oem-${DRONE_REPO_NAME} restore
# when:
# event:
# - rollback
# target:
# - oem
# - name: flush oem cdn
# pull: never
# image: oss2:latest
# volumes:
# - name: files
# path: /files
# - name: scripts
# path: /scripts
# commands:
# - sleep 3
# - echo https://web.minimi.studio/ > /scripts/oem
# - echo https://www.sailner.web/ >> /scripts/oem
# - cd /scripts && python3 /scripts/refresh.py -r oem -t clear
# when:
# event:
# - promote
# target:
# - oem
#================================= sharewow3d ==========================
volumes:
- name: files
host:
path: /data/projects/${DRONE_REPO_NAME}/dist
- name: scripts
host:
path: /home/devops/python_script/aliyun
depends_on:
- zip_file
---
kind: pipeline
type: docker
name: send_msg
clone:
disable: true
steps:
- name: notify
image: plugins/webhook
pull: never
settings:
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b38cafb9-f7fb-4eec-93ba-81b95f8fae0e
content_type: application/json
template: |
{
"msgtype": "markdown",
"markdown": {
"content": "{{#success build.status}}✅ {{else}}❌ {{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n
>**发布环境**: {{ build.deployTo }}
>**构建结果**: {{ build.status }}
>**构建详情**: [点击查看]({{ build.link }})
>**代码分支**: {{ build.branch }}
>**提交标识**: {{ build.commit }}
>**提交发起**: {{ build.author }}
>**提交信息**: {{ build.message }}
"
}
}
trigger:
event:
- deployment
- promote
- push
- rollback
status:
- success
- failure
depends_on:
- git
- build
- zip_file
- upload