使用GitHub配置Jenkins(授权) [英] Configuring Jenkins with GitHub (Authorization)

查看:94
本文介绍了使用GitHub配置Jenkins(授权)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Jenkins,以便为一群从事不同项目的人们构建GitHub项目,以使项目在Jenkins中的可见性遵循GitHub上的授权.

我之前(成功地)使用GitHub Auth插件和提交者策略"进行了此操作,但是无法重现配置.

到目前为止,我所达到的目标:

  1. 我正在docker中运行jenkins/jenkins:jdk11.
  2. 我成功配置了GitHub身份验证,即通过OAuth对用户进行身份验证(当前使用的范围是"repo,read:org,read:user"),因此他们的github名称显示为用户名.

我添加了一些github项目,并且"GitHub Committer Strategy"上次帮助我配置了可见性,但是现在我遇到了一个我不太了解的问题.

如果我将GitHub Committer Strategy的配置留空(除了admin用户),则通过身份验证的用户将看不到任何内容.出现一条消息访问被拒绝,XXX缺少总体/读取"权限"(已翻译).

当我选中使用GitHub存储库权限"时,仍然出现此错误.当我添加授予所有经过身份验证的用户的读取权限"时,用户可以看到彼此的项目.

我什至不知道它应该如何工作.如何配置插件,以便每个经过身份验证的用户都能了解其所有项目的概况?

我正在使用Jenkins 2.223和GitHub身份验证插件0.33.

解决方案

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/

    这篇关于使用GitHub配置Jenkins(授权)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆