Jenkins配置手动发版
新项目中,开发老师配置好了所有的配置信息。什么都不说了,还是看看图
- General
- 源码管理
- 构建触发器与构建环境
- 构建
#!/bin/bash -ilex mvn clean package -Dmaven.test.skip=true -Pdev /opt/jetty/bin/jetty.sh stop sleep 3s mv /opt/jetty/webapps/hcem.war /opt/jetty/webapps/hcem.war.back.`date +%Y%m%d%H%k%M` cp hcem-web/target/hcem-web.war /opt/jetty/webapps/hcem.war /opt/jetty/bin/jetty.sh start if [ $? -eq 0 ]; then echo "发布成功" else echo "发布失败,回滚" rm -fr /opt/jetty/webapps/hcem.war mv /opt/jetty/webapps/hcem.war.back /opt/jetty/webapps/hcem.war /opt/jetty/bin/jetty.sh start if [ $? -eq 0 ]; then echo "回滚失败" else echo "回滚失败" fi fi
后端代码,shell如上所示
前端代码,shell如下所示
#!/bin/bash -ilex npm run build mv /opt/hcem-front/dist /opt/hcem-front/dist_back_`date +%Y%m%d%H%k%M` mv dist/ /opt/hcem-front/
- 构建后操作