jenkins 批量修改配置文件

 

jenkin job 修改配置

修改前配置

 <runPostStepsIfResult>
<name>FAILURE</name>
<ordinal>2</ordinal>
<color>RED</color>
<completeBuild>true</completeBuild>
</runPostStepsIfResult>

修改后配置

 <runPostStepsIfResult>
<name>SUCCESS</name>
<ordinal>0</ordinal>
<color>BLUE</color>
<completeBuild>true</completeBuild>
</runPostStepsIfResult>

用sed 修改方法

1、删除 <runPostStepsIfResult> 下面3行

sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;
sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;
sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;

2、在<runPostStepsIfResult> 下面添加3行

sed -i '/<runPostStepsIfResult>/a\ <name>SUCCESS<\/name>\n <ordinal>0<\/ordinal>\n <color>BLUE<\/color>' config.xml;

shell脚本

cd /app/mount_data/jenkins_home/jobs/
sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;
sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;
sed -i '/<runPostStepsIfResult>/{n;d}' */config.xml;
sed -i '/<runPostStepsIfResult>/a\ <name>SUCCESS<\/name>\n <ordinal>0<\/ordinal>\n <color>BLUE<\/color>' config.xml;

最新文章

  1. linux下交叉编译go项目
  2. 图片上传插件ImgUploadJS:用HTML5 File API 实现截图粘贴上传、拖拽上传
  3. ASP.NET Core开发-Docker部署运行
  4. linux 常见问题&amp;解决方案
  5. MYSQL-用户操作
  6. css3中filter的各种特效
  7. [转]how to split the ng-repeat data with three columns using bootstrap
  8. codeforces A. Dima and Continuous Line 解题报告
  9. centos网页乱码
  10. spring获取bean的时候严格区分大小写
  11. vs2013 设置为中文版
  12. Linux与Windows的8个不同
  13. Hive权限介绍
  14. c++ 名字粉碎(name mangling)
  15. 移动web开发框架研究
  16. Web QQ自动强制加好友代码
  17. MVC上传文件受限制
  18. tcpdump使用技巧
  19. jni 类初始化失败(nested exception is java.lang.NoClassDefFoundError)
  20. linux下的静态库与动态库详解

热门文章

  1. (转)U3D DrawCall优化手记
  2. 5. How to set up a Activity
  3. hdu1027 Ignatius and the Princess II (全排列 &amp;amp; STL中的神器)
  4. 栅格计算器函数之Con
  5. php之快速入门学习-9(switch)
  6. Camera2必知必会
  7. Discuz的sc 和tc版本有什么区别
  8. VB调用VC dll的返回方式
  9. java面试第十三天
  10. 服务名无效。请键入 NET HELPMSG 2185 以获得更多的帮助。