该实例已启动并正在运行,但在Jenkins中创建管道时,它会请求一个Github个人访问令牌。这很糟糕,因为如果有人离开公司,我们需要重新配置他们设置的管道。
我想将Jenkins配置为使用“自动化”Github用户的个人访问令牌。
我认为可以使用Github Branch Source Plugin来完成,但是我不知道如何使用Jenkins Configuration As Code来配置它。
我的配置当前如下所示:
JCasC:
enabled: true
PluginVersion: 1.11
SupportPluginVersion: 1.11
ConfigScripts:
welcome-message: |
jenkins:
systemMessage: Welcome to our CI\CD server. This Jenkins is configured and managed 'as code'.
github-oauth: |
jenkins:
securityRealm:
github:
githubWebUri: "https://github.com"
githubApiUri: "https://api.github.com"
clientID: "<some-id>"
clientSecret: "<some-secret>"
oauthScopes: "read:org,user:email,repo"
github-org-lock: |
jenkins:
authorizationStrategy:
globalMatrix:
grantedPermissions:
- "Overall/Administer:<some-org>"发布于 2020-03-09 23:20:27
我认为创建凭据应该可以解决您的问题。
下面是我在JCasC上管理凭据的方式:
credentials: system: domainCredentials: - credentials: - usernamePassword: scope: GLOBAL id: cred-id username: "<github_username>" password: "<github_access_token>" # Access Token Rights: https://github.com/settings/tokens/new?scopes=repo,read:org,user:email,admin:repo_hook,admin:org_hook description: Account for Repository Discovery
https://stackoverflow.com/questions/55725734
复制相似问题