jenkins之 pipeline 小尝试
最近,一个小需求,动态建立slave节点来执行自动化用例,原有jenkins 老方式不满足需求,就用到jenkins2的pipeline来实现,但在实现过程中,2个小坑记录下
1、jenkins不能读取file参数中的文件
在任务有file参数时,如下:

然后在pipeline只引用env.env_conf时,发现找不到上传的文件.....<_>
查看后,原来还是一个bug,见jenkins官网说明,
代替方案:
使用multi-line string parameter参数,读取后,再写入到文件

writeFile file: 'demo.ini', text: env.config
2、post带node,带脚本
post属于构建后的操作,官网只是这样显示的
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Test') {
steps {
sh 'echo "Fail!"; exit 1'
}
}
}
post {
always {
echo 'This will always run'
}
success {
echo 'This will run only if successful'
}
failure {
echo 'This will run only if failed'
}
unstable {
echo 'This will run only if the run was marked as unstable'
}
changed {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
}
}
}
NND,这是什么,谁的post会这么简单??
我要在指定节点运行脚本,发邮件。
没办法,又是查阅资料后,原来post可以这么写:
例一:
post {
success {
script {
currentBuild.result = 'SUCCESS'
}
step([$class: 'StashNotifier'])
}
}
例二:带节点生成html,junit
post {
always {
node("xxxxx"){
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: "${env.Version}/AliApiCrul/.",
reportFiles: 'index.html',
reportName: "HTML Report"
])
junit "${env.Version}/AliApiCrul/*.xml"
}
jenkins之 pipeline 小尝试的更多相关文章
- 远程触发Jenkins的Pipeline任务的并发问题处理
前文概述 本文是<远程触发Jenkins的pipeline任务>的续篇,上一篇文章实战了如何通过Http请求远程触发指定的Jenkins任务,并且将参数传递给Jenkins任务去使用,文末 ...
- [转]利用Jenkins的Pipeline实现集群自动化部署SpringBoot项目
环境准备 Git: 安装部署使用略. Jenkins: 2.46.2版本安装部署略(修改jenkins执行用户为root,省得配置权限) JDK: 安装部署略. Maven: 安装部署略. 服务器免密 ...
- Jenkins流水线(pipeline)实战之:从部署到体验
关于Jenkins流水线(pipeline) Jenkins 流水线 (pipeline) 是一套插件,让Jenkins可以实现持续交付管道的落地和实施. 关于blueocean Blue Ocean ...
- 远程触发Jenkins的Pipeline任务
场景 虽然能配置提交代码时触发Jenkins任务,但有时并不需要每次提交代码都触发,而是仅在有需要时才执行. 除了在Jenkins页面上手动执行任务,还可以向Jenkins网站发起HTTP请求,触发指 ...
- Jenkins的Pipeline脚本在美团餐饮SaaS中的实践
一.背景 在日常开发中,我们经常会有发布需求,而且还会遇到各种环境,比如:线上环境(Online),模拟环境(Staging),开发环境(Dev)等.最简单的就是手动构建.上传服务器,但这种方式太过于 ...
- Jenkins的Pipeline脚本在美团餐饮SaaS中的实践(转)
一.背景 在日常开发中,我们经常会有发布需求,而且还会遇到各种环境,比如:线上环境(Online),模拟环境(Staging),开发环境(Dev)等.最简单的就是手动构建.上传服务器,但这种方式太过于 ...
- jenkins~管道Pipeline的使用,再见jenkinsUI
Pipeline在Jenkins里的作用 最近一直在使用jenkins进行自动化部署的工作,开始觉得很爽,省去了很多重复的工作,它帮助我自动拉服务器的代码,自动还原包包,自动编译项目,自动发布项目,自 ...
- Jenkins和pipeline
Jenkins https://jenkins.io/index.html The leading open source automation server, Jenkins provides hu ...
- jenkins的pipeline的使用
1.安装Pipeline Maven Integration Plugin 2.新建任务 3.编写pipeline代码 node { stage('get clone') { checkout([$c ...
随机推荐
- javascript中new Date()的浏览器兼容性问题
正确的做法: var time1 = (timestart+' 00:00:00').toString(); var time2 = (timeend+' 23:59:59').toString(); ...
- 奇怪吸引子---Hadley
奇怪吸引子是混沌学的重要组成理论,用于演化过程的终极状态,具有如下特征:终极性.稳定性.吸引性.吸引子是一个数学概念,描写运动的收敛类型.它是指这样的一个集合,当时间趋于无穷大时,在任何一个有界集上出 ...
- 【Zookeeper】源码分析之请求处理链(四)之FinalRequestProcessor
一.前言 前面分析了SyncReqeustProcessor,接着分析请求处理链中最后的一个处理器FinalRequestProcessor. 二.FinalRequestProcessor源码分析 ...
- linux使用pam_tally2.so模块限制登录3次失败后禁止5分钟
在线上的服务器有时需要限制用户登录次数.这个功能可以通过pam的pam_tally2.so模块来实现 PAM模块是用sun提出的一种认证机制 pam_tally2.so模块 一.格式 pam_tall ...
- Mybatis3——使用学习(一)
目录 Mybatis Mybatis参考资源 Mybatis 使用 肯定TM要跑起来 XML映射配置文件 Mapper XML 文件 Mybatis Mybatis参考资源 Mybatis官网手册:h ...
- WPF显示图片
1.WPF显示图片内部一部分 <Rectangle Height="> <Rectangle.Fill > <ImageBrush ImageSource=&q ...
- HDU_3746 Cyclic Nacklace(KMP)
题目请点我 题解: 题目大意:有一个字符串s.能够在前后加入字符,使字符串成为一个循环次数至少为2的循环字符串.输出最少须要加入的字符数目. 首先能够证明题目能够等价为仅仅在末尾加入字符使满足题意.要 ...
- 每日英语:Mrs. Obama Takes Stab at Ping-Pong Diplomacy
U.S. first lady Michelle Obama took ping-pong diplomacy to a new level on Friday on her weeklong tou ...
- 初识Spring Security
本文参考或者转自:http://haohaoxuexi.iteye.com/blog/2154299 1.新建Spring Security配置文件spring-security.xml:<?x ...
- 川崎机器人c#通讯(转)
由于本人在工业自动化行业做机器视觉的工作,所以除了图像处理方面要掌握外,还需要与工业机器人进行通信.最近学习了计算机与川崎机器人的TCP/IP通信,于是在这里记录一下. 除了直接与机器人通信外,有一种 ...