通过multibranch类型的pipeline job使得对于多个branch的支持更加简单。只需要创建一个multibranch job,jenkins将自动地为所有的branch创建job。

文章来自:http://www.ciandcd.com
文中的代码来自可以从github下载: https://github.com/ciandcd

文中用到的repo:https://github.com/ciandcd/example_jenkins_multibranch.git, 包含了master和b1两个branches。

1. Jenkinsfile内容如下:

https://github.com/ciandcd/example_jenkins_multibranch/blob/b1/Jenkinsfile
https://github.com/ciandcd/example_jenkins_multibranch/blob/master/Jenkinsfile

node (){
stage 'Build and Test'
env.PATH = "${tool 'M3'}/bin:${env.PATH}"
checkout scm
sh 'mvn clean package'
}

注意这里的checkout scm,不需要指定具体的git url。

2. 新建multibranch pipeline job

2. 自动为每个branch生成job

在multibranch pipeline job保存后,jenkins自动地检查所有的branch,且自动地为所有的branch创建job。

例如上面的job,自动地生成了文件夹pipeline_multibranch,且在此文件夹下自动地为master和b1生成了job。

然后可以自由的选择运行某些branch的job。

3. GitHub Organization or New Item → Bitbucket Team

类似地,还可以安装插件github organiztion 或 bitbucket team来自动地为所有的项目创建multibranch pipeline job。

jenkins2 multibranch的更多相关文章

  1. Jenkins pipeline 入门到精通系列文章

    Jenkins2 入门到精通系列文章. Jenkins2 下载与启动jenkins2 插件安装jenkins2 hellopipelinejenkins2 pipeline介绍jenkins2 jav ...

  2. centos7.6环境jenkins升级到tomcat8.0.53和jenkins2.168版本

    Jenkins服务器:192.168.10.175数据备份服务器:192.168.10.164 jenkins服务器报错不能访问,插件无法加载就不能正常获取代码,重启尝试解决无果,于是采用 如下方案: ...

  3. jenkins2 pipeline 语法快速参考

    jenkins2 pipeline中常用的语法快速参考. 文章来自:http://www.ciandcd.com文中的代码来自可以从github下载: https://github.com/ciand ...

  4. jenkins2 pipeline插件的10个最佳实践

    jenkins pipeline的10个最佳实践. 文章来自:http://www.ciandcd.com文中的代码来自可以从github下载: https://github.com/ciandcd ...

  5. jenkins2 pipeline高级

    jenkins2 pipeline里groovy的高级用法.翻译自:https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL. ...

  6. jenkins2 pipeline介绍

    文章来自:http://www.ciandcd.com 文中的代码来自可以从github下载: https://github.com/ciandcd   什么是jenkins2的pipeline?   ...

  7. jenkins2 hello pipeline

    文章来自:http://www.ciandcd.com 文中的代码来自可以从github下载: https://github.com/ciandcd   根据前面的2篇文章,我们已经安装和配置好了je ...

  8. Jenkins2 - 下载与启动

    文章来自:http://www.ciandcd.com 文中的代码来自可以从github下载: https://github.com/ciandcd 本文将引导jenkins初学者安装和配置jenki ...

  9. Jenkins2 插件 Pipeline+BlueOcean 实现持续交付的初次演练

    需要完成的目标 使用Pipeline完成项目的checkout,package.deploy.restart 提取出公有部分封装为公有JOB 实现pipeline对其他JOB的调用和逻辑的判断 实现任 ...

随机推荐

  1. How to Shorten the Paper

    . Remember: you are writing for an expert. Cross out all that is trivial or routine. . Avoid repetit ...

  2. Linux socket 获得本地IP和广播地址

    #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netine ...

  3. notepad++对systemverilog的支持

    找到notepad++根目录中的"langs.xml",用notepad++打开,并搜索"verilog",     找到后,修改后面那句话为ext=" ...

  4. Selenium2+python自动化5-操作浏览器基本方法

    前言 前面已经把环境搭建好了,这从这篇开始,正式学习selenium的webdriver框架.我们平常说的 selenium自动化,其实它并不是类似于QTP之类的有GUI界面的可视化工具,我们要学的是 ...

  5. Elasticsearch refresh vs. flush【转载】

    源地址:    http://www.jianshu.com/p/0e9f6346f1fe 问: 若一个新的文档索引进ES索引,则它在索引操作执行后约1s可以搜索到.然而我们可以直接调用_flush或 ...

  6. java io学习之File类

    1.先看下四个静态变量 static String pathSeparator The system-dependent path-separator character, represented a ...

  7. HashedWheelTimer 原理

    HashedWheelTimer 是根据 Hashed and Hierarchical Timing Wheels: Data Structuresfor the Efficient Impleme ...

  8. js点击按钮倒计时setTimeout和setInterval

    setTimeout() 用于在指定的毫秒数后调用函数或计算表达式,只执行 code 一次. setInterval() 可按照指定的周期(以毫秒计)来调用函数或计算表达式,不停地调用函数,直到 cl ...

  9. 阿里巴巴Json工具-Fastjson讲解

    Fastjson是阿里巴巴公司开源的速度最快的Json和对象转换工具,一个Java语言编写的JSON处理器. 1.遵循http://json.org标准,为其官方网站收录的参考实现之一.2.功能qia ...

  10. hibernate多表查询,结果封装在自己定义的一个实体类当中(在自己定义的类中增加构造函数)

    hibernate的hql查询直接返回java对象时出现问题3 向大家请教一个问题,现在有三张表,表之间没有关联,我需要将三张表里面的所有东西查询出来存储到一个新的对象中,该如何实现,使用hibern ...