一键
- 新增多节点一键滚动发版多节点,多个节点间隔25秒。
- 一键发版新增build pom文件失败时,自动终止。
- 一键发版是滚动单一节点发版,不是多个节点一起发版。
- 一键发版时,第一个节点发版失败,不会进行下一个节点发版。
- 一键发版新增,发版成功后自动打包代码到code仓库功能(自动打tag号提交到code里,如需回滚时,选择tag号自动回滚即可)
- 一键发版里的tag号,可以在单节点应用上使用。
- 一键发版弃用单节点,手动回滚功能。
- 一键回滚时选择最近的p开头tag号回滚即可。
- 目前生产已改造完。
- 图中配置文件内容deploy.ymal
--- - hosts: 10.10.0.179 tasks: - name: Close service shell: nohup /home/xiaoxin/app/sequence-sdk-starter/bin/spcserv.sh stop ignore_errors: true - name: Please wait while the service is closed. shell: sleep 15 - name: Create the code pull directory file: path: /home/xiaoxin/app/ state: directory mode: '0755' - name: Except target source file: path: /home/xiaoxin/app/sequence-sdk-starter/lib state: absent - name: Delete target source file: path: /home/xiaoxin/app/sequence-sdk-starter/conf state: absent - name: Copy the package configuration file copy: src=/var/lib/jenkins/workspace/sequence-sdk/sequence-sdk-starter/target/sequence-sdk-starter.tar.gz dest=/home/xiaoxin/app/ - name: Push sequence-sdk-starter.tar.gz unarchive: src=/home/xiaoxin/app/sequence-sdk-starter.tar.gz dest=/home/xiaoxin/app copy=no - name: Remove the tag package file: path: /home/xiaoxin/app/sequence-sdk-starter.tar.gz state: absent - name: Start the service shell: nohup /home/xiaoxin/app/sequence-sdk-starter/bin/spcserv.sh start - name: Get Service status uri: url: "http://127.0.0.1:8000" follow_redirects: none method: GET register: _result until: _result.status == 200 retries: 5 delay: 5 - hosts: 10.10.0.180 tasks: - name: Close service shell: nohup /home/xiaoxin/app/sequence-sdk-starter/bin/spcserv.sh stop ignore_errors: true - name: Please wait while the service is closed. shell: sleep 15 - name: Create the code pull directory file: path: /home/xiaoxin/app/ state: directory mode: '0755' - name: Except target source file: path: /home/xiaoxin/app/sequence-sdk-starter/lib state: absent - name: Delete target source file: path: /home/xiaoxin/app/sequence-sdk-starter/conf state: absent - name: Copy the package configuration file copy: src=/var/lib/jenkins/workspace/sequence-sdk/sequence-sdk-starter/target/sequence-sdk-starter.tar.gz dest=/home/xiaoxin/app/ - name: Push sequence-sdk-starter.tar.gz unarchive: src=/home/xiaoxin/app/sequence-sdk-starter.tar.gz dest=/home/xiaoxin/app copy=no - name: Remove the tag package file: path: /home/xiaoxin/app/sequence-sdk-starter.tar.gz state: absent - name: Start the service shell: nohup /home/xiaoxin/app/sequence-sdk-starter/bin/spcserv.sh start - name: Get Service status uri: url: "http://127.0.0.1:8000" follow_redirects: none method: GET register: _result until: _result.status == 200 retries: 5 delay: 5
Jenkins建立maven项目配置
丢弃旧的构建,输入如下即可
配置构建时的分支,如没有Git Paranmeter插件,自行在插件中安装即可。
配置代码仓库地址,关于认证,参考博客里的Jenkins结合code
Java应用deploy到maven私有仓库,Build是代码中的pom文件构建参数
maven编译打包失败后,终止操作,以及打包成功后做代码分发。
使用Post build task插件,在发版成功后自动打tag号上传到代码仓库,方便回滚时,直接选择tag号回滚即可。
自动打tag号代码
echo "$branch" master='origin/master' if [ $branch == $master ] then /usr/bin/git tag -a p_$BUILD_NUMBER -m "commit:$GIT_COMMIT" /usr/bin/git push origin p_$BUILD_NUMBER /usr/bin/git tag -d p_$BUILD_NUMBER fi
继续阅读
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论