小编典典

Jenkins Mercurial插件无法检测到更改

jenkins

当我的管道轮询Mercurial存储库以查找更改时,它不会检测到任何更改,并且不会触发新的构建。

在插件文档之后,我设置了一个推钩来触发轮询,这种方法可以正常工作,但无法检测到更改。我所得到的是

商业轮询日志

开始于五月19,2018 11:58:10下午

/ var / lib / jenkins / workspace / test-repo中没有轮询基线

做完了 花费了0毫秒

没有变化

我正在使用:-Jenkins v2.107.3-Mercurial插件v2.3

我刚刚创建了一个测试Mercurial回购,其中包含一些具有随机内容的文件以测试设置,还有一个詹金斯管道“ polling-test”,用于检查回购并回显“
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选项也已签出,没有任何计划。

我修改存储库,方法如下:

$ echo "foo" > bar
$ hg add bar
$ hg commit -m "change"
$ hg push

然后通过以下方式触发轮询

$ curl "https://jenkins-server/mercurial/notifyCommit?url=ssh://hg-user@hg-server/test-repo"
Scheduled polling of polling-test

轮询日志显示它已触发,但未发现更改。

我究竟做错了什么?如何检测变化?


阅读 377

收藏
2020-07-25

共1个答案

小编典典

通过在“全局工具”中添加Mercurial安装,并将管道脚本更改为,我能够使轮询正常工作

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"
            }
        }
    }
}

同时保持选中“轮询”选项,并且当然第一次手动运行管道以获取参考变更集。

2020-07-25