且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用GitHub配置Jenkins(授权)

更新时间:2023-02-17 12:42:31

Github身份验证插件原因:通过GitHub-OAuth使用GitHub用户凭证来管理Jenkins实例.

插件详细信息:

  • 应用程序名称:Jenkins
  • HomePageURL:您的Jenkins目标网页网址,对我来说是

    第2步:配置(詹金斯)

    • 启用安全性复选框
    • 访问控制复选框
    • Github身份验证插件
    • Github Web URI: https://github.com 或您自己的Github服务器实例
    • 客户编号:您将从Github那里获取
    • 客户端密钥:添加Jenkins时将从GitHub获得的密钥作为应用程序
    • OAuth范围:阅读:组织,用户:电子邮件,存储库

    然后授权:*基于矩阵的安全性:复选框作为签入屏幕截图进行检查

    有关更多详细信息,请阅读 https://plugins.jenkins.io/github-oauth/

    I'd like to set up a Jenkins to build GitHub projects for a group of people working on different projects in a way that the projects' visibility in Jenkins follows the authorization in GitHub.

    I did this before (successfully) using GitHub Auth Plugin and the Committer Strategy, but fail to reproduce the configuration.

    What I reached so far:

    1. I am running jenkins/jenkins:jdk11 in docker.
    2. I successfully configured GitHub Authentication, that is users are authenticated via OAuth (currently with scopes "repo, read:org, read:user"), so their github name is displayed as username.

    I added some github projects, and the "GitHub Committer Strategy" helped me to configure the visibility last time, but now I run into a problem I don't really understand.

    If I leave the configuration of the GitHub Committer Strategy blank (except for a admin user), authenticated users can't see anything. There's a message "Access denied, XXX is missing the Overall/Read permission" (translated).

    I still get this error when I check "Use GitHub Repository Permissions". When I add "Grant READ permissions to all Authenticated Users", users can see each other's projects.

    I don't even understand how it's supposed to work. How can I configure the plugin such that every authenticated user gets an overview of all his projects?

    I am using Jenkins 2.223 and GitHub Authentiction Plugin 0.33.

    Github Authentication Plugin Why: Use GitHub user credentials to administrate Jenkins instance, using GitHub-OAuth.

    Plug-in details: https://plugins.jenkins.io/github-oauth

    Configuration (Github): Step1: Github.com → Settings → Applications → Authorized OAuth Apps → Create a new Application.

    • Application Name: Jenkins
    • HomePageURL: Your Jenkins landing page URL, for me it is https://jenkis..ninja
    • Application Description: Whatever you like
    • Authorization callback: JenkinsInatnceURL/securityRealm/finishLogin please make sure your spellings are correct

    Add your application

    Step 2: Configuration (Jenkins)

    • Enable security checkbox
    • Access Control checkbox
    • Github Authentication plugin
    • Github Web URI: https://github.com or your own Github server instance
    • Client Id: which will you get from Github
    • Client Secret: Secret key that you will get from GitHub while Adding Jenkins as application
    • OAuth Scope(s): read:org,user:email,repo

    Then Authorization: * Matrix-based Security: checkbox check as checked-in screenshot

    For more details please read https://plugins.jenkins.io/github-oauth/