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 Jenkinsfile and 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 job

for (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的更多相关文章

  1. [转]利用Jenkins的Pipeline实现集群自动化部署SpringBoot项目

    环境准备 Git: 安装部署使用略. Jenkins: 2.46.2版本安装部署略(修改jenkins执行用户为root,省得配置权限) JDK: 安装部署略. Maven: 安装部署略. 服务器免密 ...

  2. Jenkins流水线(pipeline)实战之:从部署到体验

    关于Jenkins流水线(pipeline) Jenkins 流水线 (pipeline) 是一套插件,让Jenkins可以实现持续交付管道的落地和实施. 关于blueocean Blue Ocean ...

  3. 远程触发Jenkins的Pipeline任务

    场景 虽然能配置提交代码时触发Jenkins任务,但有时并不需要每次提交代码都触发,而是仅在有需要时才执行. 除了在Jenkins页面上手动执行任务,还可以向Jenkins网站发起HTTP请求,触发指 ...

  4. 远程触发Jenkins的Pipeline任务的并发问题处理

    前文概述 本文是<远程触发Jenkins的pipeline任务>的续篇,上一篇文章实战了如何通过Http请求远程触发指定的Jenkins任务,并且将参数传递给Jenkins任务去使用,文末 ...

  5. jenkins~管道Pipeline的使用,再见jenkinsUI

    Pipeline在Jenkins里的作用 最近一直在使用jenkins进行自动化部署的工作,开始觉得很爽,省去了很多重复的工作,它帮助我自动拉服务器的代码,自动还原包包,自动编译项目,自动发布项目,自 ...

  6. jenkins之 pipeline 小尝试

    最近,一个小需求,动态建立slave节点来执行自动化用例,原有jenkins 老方式不满足需求,就用到jenkins2的pipeline来实现,但在实现过程中,2个小坑记录下 1.jenkins不能读 ...

  7. jenkins的pipeline的使用

    1.安装Pipeline Maven Integration Plugin 2.新建任务 3.编写pipeline代码 node { stage('get clone') { checkout([$c ...

  8. Jenkins的Pipeline脚本在美团餐饮SaaS中的实践

    一.背景 在日常开发中,我们经常会有发布需求,而且还会遇到各种环境,比如:线上环境(Online),模拟环境(Staging),开发环境(Dev)等.最简单的就是手动构建.上传服务器,但这种方式太过于 ...

  9. Jenkins CI Pipeline scripting

    Jenkins pipeline is a suite of Jenkins plugins. Pipelines can be seen as a sequence of stages to per ...

随机推荐

  1. 测试工作常用SQL查询语句

    一.查询数值型数据: SELECT * FROM tb_name WHERE sum > 100; 查询谓词:>,=,<,<>,!=,!>,!<,=>, ...

  2. 持久化和公平分发.py

    1.消息持久化在实际应用中,可能会发生消费者收到Queue中的消息,但没有处理完成就宕机(或出现其他意外)的情况,这种情况下就可能会导致消息丢失.为了避免这种情况发生,我们可以要求消费者在消费完消息后 ...

  3. 【linux】硬盘原理简介和分区

    硬盘是计算机重要的一个部件,计算机中的数据都是保存在硬盘中,比如mysql的数据,linux系统日志及其他的应用日志,还有很多视频,音频,图片等文件都是保存在硬盘中,所以硬盘是计算机不可或缺的一个部件 ...

  4. Java 帝国之建造者模式

    Java 帝国之建造者模式 原创: 王钦誉 码农翻身 今天 本文来自王钦誉的投稿,老刘做了较大修改. 原文地址: https://xiaoqinyu0000.github.io/2018/06/11/ ...

  5. Docker自动补全容器名

    Zsh Place the completion script in your /path/to/zsh/completion (typically ~/.zsh/completion/): 下载自动 ...

  6. [bzoj1717][Milk Patterns 产奶的模式]

    题目链接 思路 先求出后缀数组,并且求出LCP.二分一下长度len.check的时候就是看有没有连续的k个后缀的LCP大于len.也就是判断是不是有连续的k-1个height大于len. 代码 #in ...

  7. JavaScript(JS)之Javascript对象BOM,History,Location,Function...(二)

    https://www.cnblogs.com/haiyan123/p/7594046.html 在JavaScript中除了null和undefined以外其他的数据类型都被定义成了对象,也可以用创 ...

  8. 第二篇-ubuntu18.04下怎么制作GIF动画

    一.在桌面打开终端 二.接着通过apt安装byzanz.sudo apt-get install byzanz 三.安装完成后在终端执行“xwininfo”.xwininfo 四.然后鼠标会变成“+” ...

  9. TestNg 5.类分组

    类分组是可以给类去分组,几个类分成不同的组. 比如,建立3个类GroupsOnClass1,GroupsOnClass2,GroupsOnClass3.   GroupsOnClass1和Groups ...

  10. MySQL信息提示不是英文问题

    安装好MySQL后,运行SQL的提示信息总不是英文mysql> select database; ERROR 1064 (42000): 安装好MySQL后,运行SQL的提示信息总不是英文 my ...