django web + Jenkins + maven部署

公司的Jenkins服务器只支持java编译,无python安装环境,因此我只在Jenkins上部署代码和打包成zip传到maven上。

  1. Jenkins配置

Jenkins配置中最为重要的两个地方是Execute shell、Archive the artifacts。由于django不是maven项目,因此不能通过pom.xml文件进行配置,而是在Execute shell中:

cd $WORKSPACE
pwd
ls
git branch -av
git checkout master
git pull
zip -r ./app.zip ../app
ls
/usr/local/apache-maven/apache-maven-3.0.5/bin/mvn deploy:deploy-file -DgroupId=×× -DartifactId=×× -Dversion=1.0.0-RC02 \
-Dpackaging=zip -Dfile=./app.zip -Durl=http://artifactory.rnd.××.com:8081/artifactory/××/ \
-DrepositoryId=×× || echo ""

Archive the artifacts通过正则的方式来指定需要保存的编译产物品,**表示当前工作目录:

**/*.zip

packaging是打包类型,file是要上传到maven的包路径,url是maven仓库,repositoryId是仓库id。

猜你喜欢

转载自blog.csdn.net/lj1404536198/article/details/80283275