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 ...
随机推荐
- shell中,2>&1详解
我们在Linux下经常会碰到nohup command>/dev/null 2>&1 &这样形式的命令.首先我们把这条命令大概分解下,首先就是一个nohup表示当前用户和系 ...
- [FJOI2015]火星商店问题(分治+可持久化)
题目描述 火星上的一条商业街里按照商店的编号1,2 ,…,n ,依次排列着n个商店.商店里出售的琳琅满目的商品中,每种商品都用一个非负整数val来标价.每个商店每天都有可能进一些新商品,其标价可能与已 ...
- 洛谷P3396 哈希冲突
分块还真是应用广泛啊...... 题意:求 解:以n0.5为界. 当p小于n0.5的时候,直接用p²大小的数组储存答案. 预处理n1.5,修改n0.5. 当p大于n0.5的时候,直接按照定义计算,复杂 ...
- windows中用bat脚本更改环境变量
机房同传了新的系统,不使用dev的话每次开机都要重新更改环境变量(其实也可以在编译命令里添加绝对路径).所以就去学习了一下用bat脚本更改path.以便每次开机可以一键更改添加环境变量 wmic en ...
- 第二十四篇-用VideoView制作一个简单的视频播放器
使用VideoView播放视频,视频路径有三种: 1. SD卡中 2. Android的资源文件中 3. 网络视频 第一种,SD卡中的方法. 路径写绝对路径,如果不能播放,可以赋予读取权限. 效果图: ...
- 激活miniconda2环境,出现activate命令不存在的解决方案(activate: No such file or directory)
miniconda2版本比较低时会出现这种报错,通过更新miniconda2就可以解决这个问题,用到的命令行: /path/to/miniconda2/conda update conda 参考链接: ...
- 第八节,配置分布式TensorFlow
由于随着神经网络层数的增多,需要训练的参数也会增多,随之而来需要的数据集就会很大,这样会造成需要更大的运算资源,而且还要消耗很长的运算时间.TensorFlow提供了一个可以分布式部署的模式,将一个训 ...
- selenium-网站demo学习-test Design-优化自动化代码
看selenium的网站的文档,里面的自动化用例设计有一些小点很靠谱.学了很多,可以用作优化自己的代码. 1.测试类型: Testing Static Content Testing Links Fu ...
- Python_反射
利用字符串的形式去对象中寻找成员 导入单个模块: commons为公共模块,inp为输入 func=getattr(commons,inp) 利用反射最大的好处是不用单个单个导入,而通过getattr ...
- Codeforces Gym 191033 E. Explosion Exploit (记忆化搜索+状压)
E. Explosion Exploit time limit per test 2.0 s memory limit per test 256 MB input standard input out ...