具体内容详见: https://issues.jenkins-ci.org/browse/JENKINS-21464?focusedCommentId=250183&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-250183

jenkins中构建里面的内容:Multiple candidate revisions

I also observed similar behavior. When 'Branch Specifier' was not unique, then checkout actually triggered another build of the same job.

This was strange, because the job didn't have Poll SCM Build Trigger checked. Actually this job had none of the Build Trigger mechanisms checked and was intended to be scheduled only manually.

The first build was executed manually with Branch Specifier = branch123 and log contained:

 > git rev-parse branch123^{commit} # timeout=10
> git rev-parse refs/remotes/origin/branch123^{commit} # timeout=10
Multiple candidate revisions
Scheduling another build to catch up with My_Build_Job_Name

At that point a new unwanted build of this job was scheduled and waited in the Build Queue. When it started, the log contained:

Started by an SCM change
Building on master

The initial problem was non-unique Branch Specifier. I will fix it by using the longer remote ref refs/remotes/origin/branch123.

Mark Waite Could you consider changing the plugin to fail instead of triggering a new build in case non-unique revision is required to be checked out? At least in case when job does not allow Poll SCM Build Trigger.


What was the job for and how this issue happened?

The job uses Jenkins job SCM Git to checkout a branch (say branch123) with Clean before checkout. Then in Execute shell build step it modifies some files in the checkout (pom.xmls), commits, tags (as tag123-rc1) and pushes. The local branch123 HEAD points to the same commit as tag123-rc1. So far so good.

Then developers push more changes into branch123 and we want to release as tag123-rc2. So we run our job again. Git-plugin does cleanup on the repository in the job workspace, but this leaves the local branch123 intact, so it still points to the same revision as tag123-rc1. (so other viable solution would be to wipe workspace between builds)

Plugin then fetches refs from remote and refs/remotes/origin/branch123 now points to the new commits made by developers. Git-plugin compares revision of both references that contain substring branch123. Since the remote branch moved, both refs now point to different revisions. Git-plugin reacts to this with 'Multiple candidate revisions' message and triggers a new build.

In case both refs point to the same revision (no changes were made on the branch between two builds), then Git-plugin checks out the single revision and no build is triggered.

 > git config remote.origin.url ssh://XXX.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
> git clean -fdx # timeout=10
> git submodule foreach --recursive git reset --hard # timeout=10
> git submodule foreach --recursive git clean -fdx # timeout=10
Fetching upstream changes from ssh://XXX.git
> git --version # timeout=10
using GIT_SSH to set credentials XXX
> git fetch --tags --progress ssh://XXX.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse branch123^{commit} # timeout=10
> git rev-parse refs/remotes/origin/branch123^{commit} # timeout=10
Multiple candidate revisions
Scheduling another build to catch up with My_Build_Job_Name

jenkins一次构建两次触发job问题的更多相关文章

  1. Jenkins: 使用groovy + job-dsl 创建并触发job

    Jenkins: 使用groovy + job-dsl 创建并触发job 背景: 我们的 Automation 测试脚本需要在10个不同语言的机器上跑,本地化测试产品. 我们用Jenkins启动测试执 ...

  2. jenkins+maven+junit构建自动化测试,整合junit xml生成直观的测试报告[留存]

    在自动化测试过程中,测试报告最能直观的体现测试的价值,之前一直使用maven+junit来构建我的自动化测试,但这样有几个缺点,一是,不能定时构建自动化任务(也许是我没有找到maven有没有提供这样的 ...

  3. Jenkins配置自动化构建

    转自: http://blog.sina.com.cn/s/articlelist_3053349671_14_1.html Jenkins 简介和安装(一) (2014-12-02 21:18:13 ...

  4. 使用jenkins SonarQube gitlab 构建自动化发布系统

    目前持续集成的生态越来越完善,工具也有很多,开源的或商业的.如: 最最流行的,也是使用最多的 Jenkins 有着持续集成DNA的ThoughtWorks GO.理念:"Deployment ...

  5. 使用Jenkins+gitlab自动化构建时排除分支

    我们的目的是gitlab上的代码有变动时会自动向Jenkins发送web钩子请求,触发指定的动作: 但默认情况下,所有分支(如测试环境和预生产)的代码有变动时都会触发,此时可以在Jenkins的项目设 ...

  6. Ubuntu系统下Jenkins的git构建基本方法

    上一博文讲到了本地脚本的构建方法. 本篇博文主要讲“Ubuntu系统下Jenkins的git构建基本方法”. 点击保存后即可完成简单的构建. 构建触发器 这个触发器是决定什么时候触发构建,可以设置为定 ...

  7. Jenkins的参数化构建

    一.参数化构建日志 1.查看效果 有时候开发需要查看服务器日志,传统的是需要运维登录服务器拉取开发所需要的服务日志,这么做的弊端是:1.如果日志比较大,拉取耗费时间.占用服务器资源.2.占用运维不必要 ...

  8. OpenShift应用镜像构建(3) - Jenkins的流水线构建

    Jenkins方式构建的定位是使用专门的CICD平台. 既支持把JenKins作为一个Pod部署到openshift内部,也支持部署在Openshift集群外部,操作上的区别是 openshift自己 ...

  9. Jenkins:参数化构建:分支|模块|回滚|打印日志

    @ 目录 多分支 安装Git Parameter Plug-In 配置参数 选择构建分支 分模块 前提 分模块build 参数配置 分模块shell脚本 mvn 的基本用法 分模块运行 Jenkins ...

随机推荐

  1. 仿苹果app下载动画-煎饼

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. Java 等额本金等额本息工具类

    原文:http://www.open-open.com/code/view/1449034309983 等额本息: /** * Description:等额本息工具类 * Copyright: Cop ...

  3. Meteor第一个应用程序

    这一个小教程将教你如何建立你的第一个 Meteor 应用程序. 步骤 1 - 创建App 要创建应用程序,我们将从命令提示符窗口运行 meteor create 命令.该应用程序的名称是 meteor ...

  4. topcoder srm 610

    div1 250pt: 题意:100*100的01矩阵,找出来面积最大的“类似国际象棋棋盘”的子矩阵. 解法:枚举矩阵宽(水平方向)的起点和终点,然后利用尺取法来找到每个固定宽度下的最大矩阵,不断更新 ...

  5. Java同步锁何时释放?

    在测试java多线程中有关 “生产者和消费者” 这个经典问题的时候,写代码测试的时候,思考到一些问题(所以还是要动手,实践才能储真知啊), synchronize 同步锁何时释放,何时获得?重新获得锁 ...

  6. HTC 328T 如何恢复出厂设置

    设置-存储-恢复出厂设置(在存储的最下面,往下拉)

  7. C# Json反序列化 数据协定类型 无法反序列化 由于未找到必需的数据成员

    背景今天在使用:C# Json 序列化与反序列化 反序列化的时候出现了以下的错误信息. System.Runtime.Serialization.SerializationException: 数据协 ...

  8. 关键路径(AOE)---《数据结构》严蔚敏

    // exam1.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> #include &l ...

  9. PHP引用是什么?

    引用是什么 在 PHP 中引用意味着用不同的名字访问同一个变量内容.这并不像 C 的指针,替代的是,引用是符号表别名.注意在 PHP 中,变量名和变量内容是不一样的,因此同样的内容可以有不同的名字.最 ...

  10. /tmp/crontab.tDoyrp: 设备上没有空间 查看文件夹所在分区 磁盘剩余空间 15g的root-mail大文件

    问题诊断: 文件夹所在磁盘已满 问题确认: 查看文件夹所在磁盘剩余空间,找出空间被消耗的文件(集) 查看文件夹所在磁盘空间的所属文件(暂未解决) [root@hadoop1 /]# df -Bg /t ...