Jenkins和pipeline
Jenkins
https://jenkins.io/index.html
The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.
http://www.cnblogs.com/itech/archive/2011/11/23/2260009.html
Jenkins的突出特点:
开源免费;
跨平台,支持所有的平台;
master/slave支持分布式的build;
web形式的可视化的管理页面;
安装配置超级简单;
tips及时快速的帮助;
已有的200多个插件;
Pipeline
https://jenkins.io/doc/book/pipeline/
Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. Pipeline provides an extensible set of tools for modeling simple-to-complex delivery pipelines "as code" via the Pipeline DSL. [1]
Typically, this "Pipeline as Code" would be written to a
Jenkinsfileand checked into a project’s source control repository, for example:pipeline {
agent any stages {
stage('Build') {
steps {
sh 'make'
}
}
stage('Test'){
steps {
sh 'make check'
junit 'reports/**/*.xml'
}
}
stage('Deploy') {
steps {
sh 'make publish'
}
}
}
}
典型场景: devops 下载 编译 测试 部署

Parallelism and Distributed Builds with Jenkins
https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins
parallel (
"stream 1" : { ... things ... },
"stream 2" : { ... things in parallel ... }
)
https://issues.jenkins-ci.org/browse/JENKINS-33185
for (int i=0; i< 2; ++i) {
stage "Stage #"+i
print 'Hello, world $i!'
}stage "Stage Parallel"
def branches = [:]
for (int i = 0; i < numHelloMessages.toInteger(); i++) {
branches["split \$ \{i\}"] = {
stage "Stage paralle l - #" + i
node('remote') {
echo 'Starting sleep'
sleep 10
echo 'Finished sleep'
}
}
}
parallel branches
Jenkins file样例库
https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/jobs-in-parallel/jobs_in_parallel.groovy
// in this array we'll place the jobs that we wish to run
def branches = [:]//running the job 4 times concurrently
//the dummy parameter is for preventing mutation of the parameter before the execution of the closure.
//we have to assign it outside the closure or it will run the job multiple times with the same parameter "4"
//and jenkins will unite them into a single run of the jobfor (int i = 0; i < 4; i++) {
def index = i //if we tried to use i below, it would equal 4 in each job execution.
branches["branch${i}"] = {
//Parameters:
//param1 : an example string parameter for the triggered job.
//dummy: a parameter used to prevent triggering the job with the same parameters value. this parameter has to accept a different value
//each time the job is triggered.
build job: 'test_jobs', parameters: [[$class: 'StringParameterValue', name: 'param1', value:
'test_param'], [$class: 'StringParameterValue', name:'dummy', value: "${index}"]]
}
}
parallel branches
Jenkins和pipeline的更多相关文章
- [转]利用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任务的并发问题处理
前文概述 本文是<远程触发Jenkins的pipeline任务>的续篇,上一篇文章实战了如何通过Http请求远程触发指定的Jenkins任务,并且将参数传递给Jenkins任务去使用,文末 ...
- jenkins~管道Pipeline的使用,再见jenkinsUI
Pipeline在Jenkins里的作用 最近一直在使用jenkins进行自动化部署的工作,开始觉得很爽,省去了很多重复的工作,它帮助我自动拉服务器的代码,自动还原包包,自动编译项目,自动发布项目,自 ...
- jenkins之 pipeline 小尝试
最近,一个小需求,动态建立slave节点来执行自动化用例,原有jenkins 老方式不满足需求,就用到jenkins2的pipeline来实现,但在实现过程中,2个小坑记录下 1.jenkins不能读 ...
- jenkins的pipeline的使用
1.安装Pipeline Maven Integration Plugin 2.新建任务 3.编写pipeline代码 node { stage('get clone') { checkout([$c ...
- Jenkins的Pipeline脚本在美团餐饮SaaS中的实践
一.背景 在日常开发中,我们经常会有发布需求,而且还会遇到各种环境,比如:线上环境(Online),模拟环境(Staging),开发环境(Dev)等.最简单的就是手动构建.上传服务器,但这种方式太过于 ...
- Jenkins CI Pipeline scripting
Jenkins pipeline is a suite of Jenkins plugins. Pipelines can be seen as a sequence of stages to per ...
随机推荐
- 20165223 《JAVA程序设计》第五周学习总结
教材学习内容总结 第七章要点 内部类 匿名类 异常类 断言 第十章要点 File类 文件字节/字符的输入.输出流 缓冲流 随机流 数组流 数据流 对象流 序列化和对象克隆 使用Scanner解析文件 ...
- 搭建简易的WebServer(基于pyhton实现简易Web框架 使用socket套接字)
1. 使用web底层socket的方式实现简易服务器的搭建,用来理解学习 # 1.导入socket模块 import socket import re import gevent import sys ...
- php关联Apache和nginx
编辑apache配置文件httpd.conf,以apache支持php vim /etc/httpd/httpd.conf添加如下二行 AddType application/x-httpd-php ...
- “adb不是内部或外部命令,也不是可运行的程序或批量文件“
首先这个问题有两种可能: 1.就是没有配置环境变量, 这个只需要将android安装:例如C:\Program File\android-sdk-windows\tools加入到 系统变量Path中, ...
- 第十一节、Harris角点检测原理(附源码)
OpenCV可以检测图像的主要特征,然后提取这些特征.使其成为图像描述符,这类似于人的眼睛和大脑.这些图像特征可作为图像搜索的数据库.此外,人们可以利用这些关键点将图像拼接起来,组成一个更大的图像,比 ...
- python 类的介绍实例
使用面向对象的优点: 1.能够更好的设计软件架构 2.维护软件模块 3.易于架构和组件的重用 类的定义: 构造函数:初始化用,写不写都可以,默认为空 类属性:属于类的对象 方法属性:不属于类的对象 私 ...
- TODO monkey笔记,PC端执行和手机端执行
微博不给力啊 吞我笔记,还好我有txt... 1.环境准备:安装Android sdk, 配置环境变量:platfrom_tools,tools,aapt;java:2.查询当前apk信息: aapt ...
- 20165232 预备作业3 Linux安装及学习
java第三次预作业--Linux安装及命令入门(学习记录) 通过老师给的学习基于VirtualBox虚拟机安装Ubuntu图文教程,我在自己笔记本上安装Linux操作系统,在安装过程中我遇到一些问题 ...
- XML异常
1.com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效 ...
- Hadoop序列化-流量汇总案例
Hadoop序列化案例-流量汇总需求 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Hadoop序列化 1>.为什么要序列化 一般来说,“活的”对象只生存在内存里,关机断 ...