Jenkins Mercurial插件无法检测到更改 [英] Jenkins Mercurial plugin does not detect changes
问题描述
当我的管道轮询Mercurial存储库以查找更改时,它不会检测到任何更改,并且不会触发新的构建.
When my pipeline polls the Mercurial repo for changes it does not detect any change, and new builds are not triggered.
在插件文档之后,我设置了一个推钩来触发轮询,该钩子工作正常,但无法检测到更改.我所能得到的是
Following the plugin docs, I set up a push hook to trigger the polling, which works fine, but is not able to detect changes. All I get is
Mercurial Polling Log
Mercurial Polling Log
开始于2018年5月19日晚上11:58:10
Started on May 19, 2018 11:58:10 PM
/var/lib/jenkins/workspace/test-repo中没有轮询基准
no polling baseline in /var/lib/jenkins/workspace/test-repo on
完成.花费了0毫秒
没有变化
我正在与: -詹金斯v2.107.3 -Mercurial插件v2.3
I am working with: - Jenkins v2.107.3 - Mercurial plugin v2.3
我刚刚创建了一个测试Mercurial回购,其中包含一些具有随机内容的文件以测试设置,还有一个詹金斯管道"polling-test",用于检查回购并回显"hello world".
I just created a test mercurial repo with some files with random content to test the setup, and a jenkins pipeline 'polling-test' which checks out the repo and echoes "hello world".
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout changelog: true,
poll: true,
scm: [
$class: 'MercurialSCM',
credentialsId: 'jenkins',
revision: 'default',
revisionType: 'BRANCH',
source: 'ssh://hg-user@hg-server/test-repo'
]
}
}
stage('Tests') {
steps {
echo "Hello World"
}
}
}
}
此外,轮询SCM"选项也已签出,没有任何计划.
Also the Poll SCM option is checked out, and without any schedule.
我修改存储库,例如:
$ echo "foo" > bar
$ hg add bar
$ hg commit -m "change"
$ hg push
然后使用以下方式触发轮询
And then the polling is triggered with
$ curl "https://jenkins-server/mercurial/notifyCommit?url=ssh://hg-user@hg-server/test-repo"
Scheduled polling of polling-test
轮询日志显示它已触发,但未发现更改.
The polling log shows it has triggered, but found no changes.
我做错了什么?如何检测到变化?
What am I doing wrong? How can changes be detected?
推荐答案
通过在全局工具"中添加Mercurial安装并将管道脚本更改为
I was able to make the polling work properly by adding a Mercurial installation in the "global tools", changing the pipeline script to
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout([$class: 'MercurialSCM', credentialsId: 'jenkins', installation: 'Mercurial', source: 'ssh://hg-user@hg-server/test-repo'])
}
}
stage('Tests') {
steps {
echo "Hello World"
}
}
}
}
,同时保持轮询"选项处于选中状态,当然当然还是第一次手动运行管道以获取参考变更集.
while keeping the Polling option checked, and of course running the pipeline a first time manually to get a reference changeset.
这篇关于Jenkins Mercurial插件无法检测到更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!