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 ...
随机推荐
- 【GPU编解码】GPU硬编码 (转)
一.OpenCV中的硬编码 OpenCV2.4.6中,已实现利用GPU进行写视频,编码过程由cv::gpu::VideoWriter_GPU完成,其示例程序如下. 1 int main(int arg ...
- c/c++ 读入一行不确定个数的整数
假设有一个文件,文件的每一行包括n个整数,整数之间以一个空格隔开,文件总共有m行,但是事先不知道n,m.如何每次从文件中读取一行整数放到一个数组中. 可以分为两步:1.首先从文件中读入一行字符串,2. ...
- ui-router 1.0 002 未登录跳转到login
ui-router transitionhooks 统一控制路由跳转, 前台控制如果没有登录就跳转到登录页面, 当然也可以在后台控制, 如果没有登录就返回对应的错误码, 然后在response中直接跳 ...
- 1209 -The MySQL server is running with the --read-only option
1209 - The MySQL server is running with the --read-only option so it cannot execute this statement ...
- oracle访问不同用户的表不添加用户名前缀
问题的出现,是技术的不断推进.为了更好地实现价值的提升! 01.用视图 create view tab1 select * from B.tab1; //在A用户下执行 02.同义词 gr ...
- 基于Centos搭建 Mono 开发环境
系统要求: CentOS 7.2 64 位操作系统 安装 Mono 安装前的准备 yum install yum-utils 执行命令添加安装包仓库 rpm --import "http:/ ...
- 11G新特性 -- 块介质恢复性能增强(block media recovery)
块介质恢复性能增强(block media recovery) :只是恢复受损的块.不需要将受损的数据文件offline.针对受损的数据块,使用备份中好的数据块进行restore和recover,避免 ...
- php Date()函数输出中文年月日时分秒
当然了,PHP的DATE函数是不可能直接输出中文的年月日的,但可以用下面这种方法自己写一个函数. 代码如下 复制代码 function today(){ date_default_timezone_s ...
- 第一部分:开发前的准备-第一章 什么是Andorid
第1章 什么是Android Android是一个移动设备的软件栈,它包含操作系统,中间件和一些关键的应用.Android SDK提供工具和必要的API用来在Android平台上使用java程序语言来 ...
- 2D空间中求两圆的交点
出处:https://stackoverflow.com/questions/19916880/sphere-sphere-intersection-c-3d-coordinates-of-colli ...