Jenkins-Pipeline 流水线发布部署项目
新建一个项目选择流水线

进入项目后,可以在【流水线-脚本】输入框中输入脚本
#语法模板
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building'
}
}
stage('Test') {
steps {
echo 'Testing'
}
}
stage('Deploy') {
steps {
echo 'Deploying'
}
}
}
}
点击流水线语法

输入仓库URL生产流水线语法

生成的流水线脚本添加到脚本中
def DEST_IP = '192.168.248.21'
pipeline {
agent any
stages {
stage('pull code') {
steps {
git 'https://gitee.com/jikers/websocket_web_chat.git'
}
}
stage ('pack') {
steps {
sh """
mvn clean
mvn package
"""
}
}
stage ('push') {
steps {
sh "scp target/*.war ${DEST_IP}:/usr/local/tomcat/webapps"
}
}
}
}
点击构建

访问测试


浙公网安备 33010602011771号