首页 > 解决方案 > Jenkins 组织文件夹扫描未检测到存储库

问题描述

詹金斯Scan Organization Folder Log看起来像这样:

Started by user Obay Abdelagdir
[Thu Dec 31 16:45:21 UTC 2020] Starting organization scan...
[Thu Dec 31 16:45:21 UTC 2020] Updating actions...
Looking up details of my-org-name...
Organization URL: https://github.com/my-org-name
[Thu Dec 31 16:45:22 UTC 2020] Consulting GitHub Organization
Connecting to https://api.github.com using 94421/****** (Github App, necessary for publishing checks)
Looking up repositories of organization my-org-name
0 repositories were processed
[Thu Dec 31 16:45:23 UTC 2020] Finished organization scan. Scan took 1.3 sec
Finished: SUCCESS

Jenkins“Github 组织文件夹”详细信息:我尝试按照此处的说明进行操作,但没有将“Github App”安装到组织(安装在用户身上),我忽略了该Configuration as Code Plugin部分。

Github 应用程序详细信息:“Github 应用程序”是使用普通 github 用户创建的,它安装在对组织具有所有者权限的用户上。因为我不能直接在组织上安装它。 编辑:我能够将应用程序的所有权转移给组织并安装它,但同样的问题仍然存在。

我的问题:上面的日志中说0 repositories were processed。但是我在组织中有一个分支,它有一个名为.jenkinsfile(是的,我将它添加到“项目识别器”)的文件,其中包含以下内容:

pipeline {
  stages {
    stage('Static Code Analysis') {
      parallel {
        stage('Pylint') {
          agent {
            label "pylint"
          }
          steps {
            sh "pylint --exit-zero --load-plugins=pylint_odoo 0-e odoolint --rcfile=./.pylintrc * > pylint.log"
          }
        }
      }
    }
  }
}

另一个问题是 github 检查不起作用,它在构建日志中给出以下内容:

[GitHub Checks] Failed Publishing GitHub checks: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/my-org-name/my-repo {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#get-a-repository"}
[GitHub Checks] Failed Publishing GitHub checks: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/my-org-name/my-repo {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#get-a-repository"}
Finished: SUCCESS

标签: jenkinsjenkins-github-plugin

解决方案


回答我自己的问题。

必须在组织上安装 github 应用程序。最好的(也许是唯一的)方法如下:

  1. 使用您的普通用户帐户登录
  2. 打开组织网址,https://github.com/YOUR-ORG-NAME
  3. 打开Settings标签,点击Developer settings
  4. Developer settings下面应该有两个选项OAuth AppsGithub Apps,点击Github Apps
  5. 然后按照插件文档中的说明进行操作。
  6. 最后确保在组织中安装该应用程序。

推荐阅读