错误:在 sk-node(83) 上的 /home/jenkins/test 中轮询失败 java.io.IOException:错误=2,没有这样的文件或目录

问题描述 投票:0回答:1

我配置了 Jenkins 管道来克隆我的存储库。当我手动单击“立即构建”按钮时,它工作正常,但是当我尝试在 GitHub 存储库中进行新提交并且该 webhook 有效负载也到达 Jenkins 时,管道被戳,但管道未触发。我的系统日志中没有收到“在管道中检测到 scm 更改。触发#buildNumber”行。我在管道配置中启用了“GITScm 轮询的 GitHub 挂钩触发器”。

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 更改未在管道中检测到。

github jenkins jenkins-pipeline webhooks cloning
1个回答
0
投票

实际上,当 webhook 负载到达 Jenkins 时,我遇到了这种错误。此错误背后的原因是,每当在 GitHub 存储库中进行新提交时,Webhook 有效负载就会到达 Jenkins master,并且在 Jenkins master 中,管道会根据管道代码进行验证。这意味着在分支上进行的提交与我们在管道代码中指定的分支相同或不同,那么只有 Jenkins master 才会使用我们在节点中指定的用户凭据执行管道(检测到 SCM 更改)并会触发相应的管道)。我犯的错误是“GIT 没有安装在我的 Jenkins master 中,为什么管道没有验证然后我在 Jenkins master 中安装了 git 并执行了一个名为“which git”的命令,这给了我 Jenkins master 中的 git 路径,我将此路径粘贴到 管理 Jenkins --> 工具 --> Git 安装 --> git 可执行文件的路径

现在 Jenkins 检测到更改并触发管道

© www.soinside.com 2019 - 2024. All rights reserved.