jenkins - 如何使用 github oAuth token 和 Git 插件 Jenkins

标签 jenkins github jenkins-plugins jenkins-github-plugin

我一直在 Jenkins 中使用 Git 插件从 GitHub 存储库中提取源代码。
我一直在使用用户名和密码进行身份验证

enter image description here

但是,GitHub 有 announced

Deprecation Notice: GitHub will discontinue password authentication to the API. You must now authenticate to the GitHub API with an API token, such as an OAuth access token, GitHub App installation access token, or personal access token, depending on what you need to do with the token



所以我需要更改身份验证以使用 oAuth token 。

1> 我在 GitHub 中创建了一个 oAuth token
2> 然后在 Jenkins 我创建了 Secret Text作为全局凭证。 (使用 GitHub 的 oAuth token )
3> 但是,当我转到作业配置时,Git 插件不会在类型为 secret text 的 DropDownList 中显示任何凭据。 (虽然它显示了所有其他凭据)

我如何配置 Git Pug-in 以使用 oAuth token ?

最佳答案

首先检查您是否有 github-oauth Jenkins 插件已安装,如“Use the Jenkins OAuth plug-in to securely pull from GitHub”中所述,来自 Walker Rowe .

这将允许将您的 Jenkins 服务器注册为一个可以访问 GitHub 资源的应用程序:

https://cdn.ttgtmedia.com/rms/editorial/TSS_jenkins_oauth_041018_fig5_desktop.png

关于jenkins - 如何使用 github oAuth token 和 Git 插件 Jenkins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59383728/

相关文章:

jenkins - 在 Jenkins 手动批准后开始工作

git - 如何从 github 迁移到 bitbucket?

github - 需要github,没有用户名和密码

jenkins - 如何限制用户访问我的 Jenkins 奴隶?

azure - 使用 Jenkins-agent 作为 Azure 容器实例

javascript - 关于将闭包编译器集成到构建流程的建议

Jenkins 在实际失败时验证 JMeter 构建成功

jenkins - 当文件确实存在于系统中时,Groovy 会报告该文件不存在

php - 如何在运行测试前启动 PHP 内置 Web 服务器并在测试运行后关闭它

jenkins - 超出 GitHub API 速率限制