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.
56 lines
1.3 KiB
56 lines
1.3 KiB
|
|
kind: pipeline
|
|
type: docker
|
|
name: 开发流水线
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
steps:
|
|
- name: maven
|
|
image: maven:3-jdk-10
|
|
commands:
|
|
- ls
|
|
- cd visualization
|
|
- mvn clean package -DskipTests=true
|
|
# 本模板示例为上传软件包和部署脚本到home目录
|
|
# host、username、password可在参数管理中配置
|
|
- name: 上传文件
|
|
image: appleboy/drone-scp
|
|
settings:
|
|
host:
|
|
from_secret: data_ip
|
|
username:
|
|
from_secret: data_user
|
|
password:
|
|
from_secret: data_pwd
|
|
port: 52222
|
|
target: /opt
|
|
source:
|
|
- visualization
|
|
# 需要将软件包与部署脚本提前上传到远程主机(见文件上传模板)
|
|
# host、username、password可在参数管理中配置
|
|
- name: 远程主机部署
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: data_ip
|
|
username:
|
|
from_secret: data_user
|
|
password:
|
|
from_secret: data_pwd
|
|
port: 52222
|
|
script:
|
|
- echo ====暂停容器开始11=======
|
|
- cd /opt/visualization
|
|
- tomcat=$(netstat -nlp | grep :8080 | awk '{print $7}' | awk -F"/" '{ print $1 }')
|
|
- kill -9 $tomcat >/dev/null 2>&1
|
|
- ls
|
|
- mvn clean package
|
|
- java -jar target/demo-0.0.1-SNAPSHOT.jar
|
|
- echo ====部署成功======
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
- push
|