Error:polling failed in /home/jenkins/test on sk-node(83)java.io.IOException:error=2,No such file or directory

2eafrhcq  于 11个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(119)

我配置了一个Jenkins管道来克隆我的仓库。当我手动点击build now按钮时,它工作正常,但是当我尝试在我的GitHub仓库中进行新的提交时,webhook payload也会到达Jenkins,管道被插入,但管道没有被触发。我没有在系统日志中看到“管道中检测到scm更改。正在触发#buildNumber”这一行。我启用了“GitHub hook trigger for GITScm polling”in my pipeline configuration.

pipeline {
    agent { label 'my-node' }
    stages {
        stage('Clone repository') {
            environment {
                GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
               // SMTP_CREDENTIALS = credentials('SESSMTP')
            }
            steps {
               dir('/home/jenkins/test4/') {
                    git branch: 'master',credentialsId: 'github-cred', url: 'https://github.com/example/example.git'
                }
            }
        }
    }
}

字符串
这是我正在使用的管道,我所有的凭据都是正确的。我正在使用一个带有多个分支的私有回购。
我想知道为什么SCM的变化没有在管道中检测到。

vlf7wbxs

vlf7wbxs1#

事实上,当webhook payload到达Jenkins时,我得到了这种错误。这个错误背后的原因是,每当在GitHub存储库中进行新的提交时,webhook payload都会到达Jenkins master,而在Jenkins master中,管道会根据管道代码进行验证。这意味着在分支上进行的提交和我们在管道代码中指定的分支是否相同,只有Jenkins master将使用我们在节点中指定的用户凭据执行管道(SCM的变化被检测到,相应的管道将被触发).我犯的错误是“GIT没有安装在我的Jenkins主程序中,为什么管道没有被验证,然后我在Jenkins主程序中安装了git,并执行了一个名为“which git”的命令。这给了我Jenkins master中的git路径,我将此路径粘贴到Manage Jenkins->Tools->Git installations->Path to git executable
现在,Jenkins检测到了更改,并触发了管道

相关问题