Fetch the repository succeeded.
This action will force synchronization from vitojc/smart-city, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
#!/usr/bin/env groovy
pipeline {
agent any
environment {
DEPLOY_IP_LIST = ""
}
stages {
stage('编译打包') {
steps {
echo "==========编译开始=========="
sh "mvn clean package -Dmaven.test.skip=true"
echo "==========编译结束=========="
}
}
stage('构建镜像') {
steps {
echo "==========构建镜像开始=========="
sh '''
for element in `find /var/lib/jenkins/workspace/sc -name 'Dockerfile'`
do
echo ${element%/*}
cd ${element%/*}
mvn clean package dockerfile:build
done
'''
echo "==========构建镜像结束=========="
}
}
stage('发布镜像') {
steps {
echo "==========发布镜像开始=========="
sh '''
for element in `find /var/lib/jenkins/workspace/sc -name 'Dockerfile'`
do
echo ${element%/*}
cd ${element%/*}
mvn clean package dockerfile:push
done
'''
echo "==========发布镜像结束=========="
}
}
stage('部署服务') {
steps {
echo "==========部署服务开始=========="
sh '''
ips=("ip1" "ip2")
for element in ${ips[@]}
do
echo $element
sudo ssh ${element} -t 'cd /data; ls; docker-compose stop; docker-compose up -d; bash --login\'
done
'''
echo "==========部署服务结束=========="
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。