DroneDemos/.drone.yml

105 lines
2.4 KiB
YAML

---
kind: pipeline
type: docker
name: "Docker Pipeline"
steps:
- name: "中文STEP"
image: node:latest
pull: if-not-exists
commands:
- echo "********************"
- date
- whoami
- hostname
- echo "********************"
- name: "测试Python用例"
image: "lzwang/python3.10:tsinghua"
pull: if-not-exists
commands:
- pip install --upgrade pip
- pip -V
- python -V
- pip install -r ./python/requirements.txt
- pwd
- ls -la
- python ./python/hello.py
- pytest ./python/test_demo.py
- name: "CI失败 微信推送"
# https://plugins.drone.io/plugins/wechat-2
image: clem109/drone-wechat
pull: if-not-exists
settings:
corpid:
from_secret: wechat_corp_id
corp_secret:
from_secret: wechat_corp_secret
agent_id:
from_secret: wechat_agent_id
title: "${DRONE_REPO_NAME} ⚠️"
description: "Build No.${DRONE_BUILD_NUMBER} FAILED.
${DRONE_COMMIT_AUTHOR} please fix it, for more detail
visit ${DRONE_BUILD_LINK}"
msg_url: ${DRONE_BUILD_LINK}
btn_txt: btn
when:
status:
- failure
- name: "CI通过 微信推送"
# https://plugins.drone.io/plugins/wechat-2
image: clem109/drone-wechat
pull: if-not-exists
settings:
corpid:
from_secret: wechat_corp_id
corp_secret:
from_secret: wechat_corp_secret
agent_id:
from_secret: wechat_agent_id
title: "${DRONE_REPO_NAME} ✅"
description: "Build No.${DRONE_BUILD_NUMBER} Success!
${DRONE_COMMIT_AUTHOR}, for more detail visit ${DRONE_BUILD_LINK}"
msg_url: ${DRONE_BUILD_LINK}
btn_txt: btn
when:
status:
- success
---
kind: pipeline
type: ssh
name: SSH Pipeline
server:
host: 38.55.104.160
user: root
password:
from_secret: aus_pw
steps:
- name: Show System Env
commands:
- echo hello world
- whoami
- date
- ls
- name: Show Docker Env
commands:
- docker ps
- docker images
- name: Build Docker Image
environment:
USERNAME:
from_secret: docker_hub_username
TOKEN:
from_secret: docker_hub_token
commands:
- echo $USERNAME
- docker build . -t lzwang/python3.10:vps -f ./Dockerfile
- docker login -u $USERNAME -p $TOKEN
- docker push lzwang/python3.10:vps