2024-08-07 14:43:04 +08:00
|
|
|
|
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|
|
|
|
|
|
|
|
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
|
|
|
|
|
|
|
|
|
name: filesystem-drone # 定义流水线名称
|
|
|
|
|
|
2024-09-25 18:12:23 +08:00
|
|
|
|
clone:
|
|
|
|
|
disable: true
|
2024-08-07 14:43:04 +08:00
|
|
|
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|
|
|
|
|
2024-09-25 17:59:13 +08:00
|
|
|
|
- name: package-and-push-image
|
2024-08-07 14:43:04 +08:00
|
|
|
|
|
|
|
|
|
image: appleboy/drone-ssh # SSH工具镜像
|
|
|
|
|
|
|
|
|
|
settings:
|
|
|
|
|
|
|
|
|
|
host: 101.43.112.107 # 远程连接地址
|
|
|
|
|
|
|
|
|
|
username: root # 远程连接账号
|
|
|
|
|
|
|
|
|
|
password:
|
|
|
|
|
|
|
|
|
|
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
|
|
|
|
|
|
|
|
port: 22 # 远程连接端口
|
|
|
|
|
|
|
|
|
|
command_timeout: 5m # 远程执行命令超时时间
|
|
|
|
|
|
|
|
|
|
script:
|
2024-09-25 17:59:13 +08:00
|
|
|
|
- cd /root/allLikeMall
|
|
|
|
|
- git fetch origin
|
2024-09-25 18:12:23 +08:00
|
|
|
|
- git reset --hard origin/master
|
2024-09-25 17:59:13 +08:00
|
|
|
|
- git clean -fd
|
2024-09-26 09:21:56 +08:00
|
|
|
|
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
2024-09-25 17:59:13 +08:00
|
|
|
|
- cd yudao-server
|
|
|
|
|
- chmod +x push.sh
|
|
|
|
|
- ./push.sh
|
2024-09-26 09:21:56 +08:00
|
|
|
|
- scp run.sh root@1.14.205.126:/zymail/build
|
2024-08-07 22:34:52 +08:00
|
|
|
|
# - ls
|
2024-09-25 17:59:13 +08:00
|
|
|
|
# - scp -r /zymail/maven/build root@1.14.205.126:/zymail
|
2024-08-07 22:34:52 +08:00
|
|
|
|
# - ssh root@1.14.205.126
|
|
|
|
|
# - ls
|
2024-08-07 14:43:04 +08:00
|
|
|
|
|
|
|
|
|
# - chmod +x run.sh # 更改为可执行脚本
|
|
|
|
|
|
|
|
|
|
# - ./run.sh # 运行脚本打包应用镜像并运行
|
2024-08-07 22:34:52 +08:00
|
|
|
|
- name: build-start
|
|
|
|
|
|
|
|
|
|
image: appleboy/drone-ssh # SSH工具镜像
|
|
|
|
|
|
|
|
|
|
settings:
|
|
|
|
|
|
|
|
|
|
host: 1.14.205.126 # 远程连接地址
|
|
|
|
|
|
|
|
|
|
username: root # 远程连接账号
|
2024-08-07 14:43:04 +08:00
|
|
|
|
|
2024-08-07 22:34:52 +08:00
|
|
|
|
password:
|
2024-08-07 14:43:04 +08:00
|
|
|
|
|
2024-08-07 22:34:52 +08:00
|
|
|
|
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
|
|
|
|
|
|
|
|
port: 22 # 远程连接端口
|
|
|
|
|
|
|
|
|
|
command_timeout: 5m # 远程执行命令超时时间
|
|
|
|
|
|
|
|
|
|
script:
|
|
|
|
|
# - ls
|
|
|
|
|
- cd /zymail/build
|
|
|
|
|
- chmod +x run.sh # 更改为可执行脚本
|
|
|
|
|
- ./run.sh # 运行脚本打包应用镜像并运行
|