How to use jenkins configuration as code
- 本文基於在
Kubernetes
裡使用Jenkins
Configuration as Code - 使用
Jenkins
Chart
Installation
開啟 master.JCasC.enabled
,詳細可以參考官方 values
Usage
you can reference examples of official provide.
Sections:
- credentials
- jenkins
- security
- unclassified
- tool
Github OAuth
configure
securityRealm
injenkins
section1
2
3
4
5
6
7
8jenkins:
securityRealm:
github:
clientID: # get from github oauth app client id
clientSecret: # get from github oauth app client secret
githubApiUri: "https://api.github.com" # if you use github enterprise, might change it
githubWebUri: "https://github.com" # if you use github enterprise, might change it
oauthScopes: "read:org,user:email,repo"configure
authorizationStrategy
injenkins
section1
2
3
4
5
6
7
8
9
10
11
12jenkins:
authorizationStrategy:
github:
adminUserNames: # admin user name of your organization
allowAnonymousJobStatusPermission: true # can anonymous read job's status?
allowAnonymousReadPermission: false # can anonymous read job?
allowCcTrayPermission: false
allowGithubWebHookPermission: true
authenticatedUserCreateJobPermission: true
authenticatedUserReadPermission: true
organizationNames: # your organization
useRepositoryPermissions: trueconfigure CSRF
1 | jenkins: |
Credentials
1 | credentials: |
Update Config
How to update the config
1 | NS=cicd # namespace |