* Don't validate external credential type The operator shouldn't try to fetch credentials that have their types defined as `external` - that means that credentials are supplied externally, without using k8s secrets. * Docs: Add example of `external` credential type
This commit is contained in:
		
							parent
							
								
									332c08ccf2
								
							
						
					
					
						commit
						41dac85ea1
					
				|  | @ -55,8 +55,7 @@ func (s *seedJobs) ValidateSeedJobs(jenkins v1alpha2.Jenkins) ([]string, error) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if seedJob.JenkinsCredentialType == v1alpha2.BasicSSHCredentialType || | 		if seedJob.JenkinsCredentialType == v1alpha2.BasicSSHCredentialType || | ||||||
| 			seedJob.JenkinsCredentialType == v1alpha2.UsernamePasswordCredentialType || | 			seedJob.JenkinsCredentialType == v1alpha2.UsernamePasswordCredentialType { | ||||||
| 			seedJob.JenkinsCredentialType == v1alpha2.ExternalCredentialType { |  | ||||||
| 			secret := &v1.Secret{} | 			secret := &v1.Secret{} | ||||||
| 			namespaceName := types.NamespacedName{Namespace: jenkins.Namespace, Name: seedJob.CredentialID} | 			namespaceName := types.NamespacedName{Namespace: jenkins.Namespace, Name: seedJob.CredentialID} | ||||||
| 			err := s.Client.Get(context.TODO(), namespaceName, secret) | 			err := s.Client.Get(context.TODO(), namespaceName, secret) | ||||||
|  |  | ||||||
|  | @ -221,6 +221,26 @@ stringData: | ||||||
| ### External authentication | ### External authentication | ||||||
| You can use `external` credential type if you want to configure authentication using Configuration As Code or Groovy Script. | You can use `external` credential type if you want to configure authentication using Configuration As Code or Groovy Script. | ||||||
| 
 | 
 | ||||||
|  | Example: | ||||||
|  | ```yaml | ||||||
|  | apiVersion: jenkins.io/v1alpha2 | ||||||
|  | kind: Jenkins | ||||||
|  | metadata: | ||||||
|  |   name: example | ||||||
|  | spec: | ||||||
|  |   seedJobs: | ||||||
|  |   - id: jenkins-operator-external | ||||||
|  |     credentialType: external | ||||||
|  |     credentialID: k8s-external | ||||||
|  |     targets: "cicd/jobs/*.jenkins" | ||||||
|  |     description: "Jenkins Operator repository" | ||||||
|  |     repositoryBranch: master | ||||||
|  |     repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Remember that `credentialID` must match the id of the credentials configured in Jenkins. Consult the | ||||||
|  | [Jenkins docs for using credentials][jenkins-using-credentials] for details. | ||||||
|  | 
 | ||||||
| ## HTTP Proxy for downloading plugins | ## HTTP Proxy for downloading plugins | ||||||
| 
 | 
 | ||||||
| To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins Custom Resource (CR), e.g.: | To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins Custom Resource (CR), e.g.: | ||||||
|  | @ -313,3 +333,4 @@ Example config file to modify and use: | ||||||
| 
 | 
 | ||||||
| [job-dsl]:https://github.com/jenkinsci/job-dsl-plugin | [job-dsl]:https://github.com/jenkinsci/job-dsl-plugin | ||||||
| [kubernetes-credentials-provider]:https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ | [kubernetes-credentials-provider]:https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ | ||||||
|  | [jenkins-using-credentials]:https://www.jenkins.io/doc/book/using/using-credentials/ | ||||||
|  |  | ||||||
|  | @ -221,6 +221,26 @@ stringData: | ||||||
| ### External authentication | ### External authentication | ||||||
| You can use `external` credential type if you want to configure authentication using Configuration As Code or Groovy Script. | You can use `external` credential type if you want to configure authentication using Configuration As Code or Groovy Script. | ||||||
| 
 | 
 | ||||||
|  | Example: | ||||||
|  | ```yaml | ||||||
|  | apiVersion: jenkins.io/v1alpha2 | ||||||
|  | kind: Jenkins | ||||||
|  | metadata: | ||||||
|  |   name: example | ||||||
|  | spec: | ||||||
|  |   seedJobs: | ||||||
|  |   - id: jenkins-operator-external | ||||||
|  |     credentialType: external | ||||||
|  |     credentialID: k8s-external | ||||||
|  |     targets: "cicd/jobs/*.jenkins" | ||||||
|  |     description: "Jenkins Operator repository" | ||||||
|  |     repositoryBranch: master | ||||||
|  |     repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Remember that `credentialID` must match the id of the credentials configured in Jenkins. Consult the | ||||||
|  | [Jenkins docs for using credentials][jenkins-using-credentials] for details. | ||||||
|  | 
 | ||||||
| ## HTTP Proxy for downloading plugins | ## HTTP Proxy for downloading plugins | ||||||
| 
 | 
 | ||||||
| To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins Custom Resource (CR), e.g.: | To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins Custom Resource (CR), e.g.: | ||||||
|  | @ -313,3 +333,4 @@ Example config file to modify and use: | ||||||
| 
 | 
 | ||||||
| [job-dsl]:https://github.com/jenkinsci/job-dsl-plugin | [job-dsl]:https://github.com/jenkinsci/job-dsl-plugin | ||||||
| [kubernetes-credentials-provider]:https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ | [kubernetes-credentials-provider]:https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ | ||||||
|  | [jenkins-using-credentials]:https://www.jenkins.io/doc/book/using/using-credentials/ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue