简体   繁体   English

MultiBranch管道github webhook

[英]MultiBranch pipeline github webhook

Title pretty much says it all. 标题几乎说明了一切。 I've seen these: 我看过这些:

How to trigger Multibranch Pipeline build with github webhook 如何使用github webhook触发Multibranch Pipeline构建
https://support.cloudbees.com/hc/en-us/articles/224543927-GitHub-webhook-configuration https://support.cloudbees.com/hc/en-us/articles/224543927-GitHub-webhook-configuration
https://support.cloudbees.com/hc/en-us/articles/115003019232-GitHub-Webhook-Pipeline-Multibranch https://support.cloudbees.com/hc/en-us/articles/115003019232-GitHub-Webhook-Pipeline-Multibranch

I have a github server setup in jenkins, but cannot choose it in the multibranch source (as one of the links suggests), it asks for credentials but no credentials are in the dropdown. 我在jenkins中有一个github服务器设置,但是不能在多分支源中选择它(如链接之一所示),它要求提供凭据,但下拉列表中没有凭据。

I've also setup a github webhook, but I dont think it makes any difference 我还设置了一个github webhook,但我认为这没有什么区别

So, you need just add(create) this credentials in order to be able choose them in dropdown. 因此,您只需要添加(创建)此凭据即可在下拉列表中选择它们。 It could be API key or SSH key. 它可以是API密钥或SSH密钥。 One of your links includes the manual how generate API key: 您的链接之一包括手册如何生成API密钥:

You need Credentials for each of the GitHub/GitHub Enterprise Server added here. 您需要为此处添加的每个GitHub / GitHub Enterprise Server提供凭据。 Jenkins needs a Personal API token to interact with the GitHub via webhooks. Jenkins需要一个Personal API令牌才能通过webhooks与GitHub进行交互。 This token can be either created manually or automatically (see next section). 可以手动或自动创建此令牌(请参阅下一节)。 Credentials from User: Admin permissions are required at the repository level but Owner role is required to create it at Organization level; 来自用户的凭据:在存储库级别需要管理员权限,但是在组织级别创建它需要拥有者角色; For updating commit statuses / reading the list of collaborators, Write permission is required. 要更新提交状态/阅读协作者列表,需要具有写权限。 You can find more information on the GitHub token permissions in GitHub Permissions and API token Scopes for Jenkins. 您可以在GitHub权限和Jenkins的API令牌范围中找到有关GitHub令牌权限的更多信息。

Setting up the Credentials As explained in the previous section, the plugin needs a token to work. 设置凭据如上一节所述,插件需要一个令牌才能工作。 You can choose to let Jenkins create the token on your behalf, or create it manually. 您可以选择让Jenkins代表您创建令牌,也可以手动创建令牌。

Let Jenkins create the token: this option is only available if you are not using two-factor authentication. 让Jenkins创建令牌:仅当您未使用两因素身份验证时,此选项才可用。 You can make Jenkins generate the token by going to Advanced > Manage Additional GitHub Actions > Convert Login and Password to token. 您可以通过转到高级>管理其他GitHub动作>将登录名和密码转换为令牌来使Jenkins生成令牌。

Generate the token yourself: first generate a token (make sure to read the previous section to understand what rights to grant). 自己生成令牌:首先生成令牌(请务必阅读上一节以了解要授予的权限)。 Then in the Credentials section (under the API URL) create a Credential of type Secret Text and put the token you generated as a secret text. 然后,在“凭据”部分(位于API URL下)中,创建一个类型为“秘密文本”的凭据,并将生成的令牌作为秘密文本放置。

You can find more information on the GitHub token permissions here: https://support.cloudbees.com/hc/en-us/articles/234710368-GitHub-User-Scopes-and-Organization-Permission 您可以在此处找到有关GitHub令牌权限的更多信息: https : //support.cloudbees.com/hc/en-us/articles/234710368-GitHub-User-Scopes-and-Organization-Permission

I hope it will help you. 希望对您有帮助。

我需要使用用户名等于用户名和密码等于github令牌创建凭证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM