轮询可用于轻量级结帐吗?

时间:2018-11-02 12:00:01

标签: jenkins-pipeline

我正在使用“从scm签出构建脚本”选项,并与轻量级签出配对。

我想为此添加存储库轮询。

这是我使用的Jenkinsfile:

pipeline {
    agent any
    triggers {
      pollSCM('H/1 * * * *')
    }
    stages {
        stage('Checkout') {
            steps {
                checkout([
                        $class                           : 'GitSCM',
                        branches                         : [[name: 'master']],
                        userRemoteConfigs                : [[url: 'file:///home/my-secret-home/workspace/pipeline-test']]])
            }
        }
        stage('Echo!') {
            steps {
                sh 'echo TEST'
            }
        }
    }
}

尽管作业正在运行,但git polling log试图说服我“轮询尚未运行。”

完全可以配置这种行为吗?

1 个答案:

答案 0 :(得分:1)

不,它不起作用。

通过轻量级签出,到远程分支的映射将丢失,因此git不知道在哪里寻找进一步的更新。

enter image description here

您还可以通过在本地存储库上运行git pull来确认这一点。它返回:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master
相关问题