Update README.md and developer-guide.md
This commit is contained in:
		
							parent
							
								
									5091ce86c5
								
							
						
					
					
						commit
						7e64f2f06e
					
				
							
								
								
									
										18
									
								
								README.md
								
								
								
								
							
							
						
						
									
										18
									
								
								README.md
								
								
								
								
							|  | @ -1,14 +1,16 @@ | ||||||
| # jenkins-operator | # jenkins-operator | ||||||
| 
 | 
 | ||||||
| Kubernetes native Jenkins operator | Kubernetes native Jenkins operator. | ||||||
| 
 | 
 | ||||||
| ## Developer guide | ## Developer guide | ||||||
| 
 | 
 | ||||||
| Can be found [here][developer_guide] | Can be found [here][developer_guide]. | ||||||
| 
 | 
 | ||||||
| ## TODO | ## TODO | ||||||
| 
 | 
 | ||||||
| - send Kubernetes events | Common: | ||||||
|  | - simple library for sending Kubernetes events | ||||||
|  | - implement Jenkins.Status in custom resource | ||||||
| 
 | 
 | ||||||
| Base configuration: | Base configuration: | ||||||
| - install configuration as a code Jenkins plugin | - install configuration as a code Jenkins plugin | ||||||
|  | @ -17,11 +19,11 @@ Base configuration: | ||||||
| - disable insecure options | - disable insecure options | ||||||
| 
 | 
 | ||||||
| User configuration: | User configuration: | ||||||
| - AWS s3 restore backup job | - user reconciliation loop (work in progress) | ||||||
| - AWS s3 backup job | - configure seed jobs and deploy keys (work in progress) | ||||||
| - create and run seed jobs | - e2e tests for seed jobs | ||||||
| - apply custom configuration by configuration as a code Jenkins plugin | - backup and restore for Jenkins jobs running as standalone job | ||||||
| - trigger backup job before pod deletion | - trigger backup job before pod deletion using preStop k8s hooks | ||||||
| - verify Jenkins configuration events | - verify Jenkins configuration events | ||||||
| 
 | 
 | ||||||
| [developer_guide]:doc/developer-guide.md | [developer_guide]:doc/developer-guide.md | ||||||
|  | @ -3,70 +3,102 @@ | ||||||
| This document explains how to setup your dev environment. | This document explains how to setup your dev environment. | ||||||
| 
 | 
 | ||||||
| ## Prerequisites | ## Prerequisites | ||||||
|  | 
 | ||||||
| - [dep][dep_tool] version v0.5.0+ | - [dep][dep_tool] version v0.5.0+ | ||||||
| - [git][git_tool] | - [git][git_tool] | ||||||
| - [go][go_tool] version v1.10+ | - [go][go_tool] version v1.10+ | ||||||
|  | - [minikube][minikube] version v0.31.0+ (preferred Hypervisor - [virtualbox][virtualbox]) | ||||||
|  | - [docker][docker_tool] version 17.03+ | ||||||
| 
 | 
 | ||||||
| ## Download Operator SDK | ## Clone repository and download dependencies | ||||||
| 
 | 
 | ||||||
| Go to the [jenkins-operator repo][jenkins-operator] and follow the [fork guide][fork_guide] to fork, clone, and setup the local jenkins-operator repository. | ```bash | ||||||
| 
 | mkdir -p $GOPATH/src/github.com/VirtusLab | ||||||
| ## Vendor dependencies | cd $GOPATH/src/github.com/VirtusLab/ | ||||||
| 
 | git clone git@github.com:VirtusLab/jenkins-operator.git | ||||||
| Run the following in the project root directory to update the vendored dependencies: | cd jenkins-operator | ||||||
| 
 | make go-dependecies | ||||||
| ```sh |  | ||||||
| $ cd $GOPATH/src/github.com/VirtusLab/jenkins-operator |  | ||||||
| $ make go-dependencies |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ## Build the Operator | ## Build and run | ||||||
| 
 | 
 | ||||||
| Build the Operator `jenkins-operator` binary: | Build and run `jenkins-operator` locally: | ||||||
| 
 | 
 | ||||||
| ```sh | ```bash | ||||||
| $ make build | make build && make docker-build && make minikube-run EXTRA_ARGS='--minikube --local' | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Build the Operator `jenkins-operator` docker image: | Once minikube and `jenkins-operator` are up and running, apply CR file: | ||||||
| 
 | 
 | ||||||
| ```sh | ```bash | ||||||
| $ make build | kubectl apply -f jenkins-operator/deploy/crds/virtuslab_v1alpha1_jenkins_cr.yaml | ||||||
| $ make docker-build | kubectl get jenkins -o yaml | ||||||
| ``` | kubectl get po | ||||||
| 
 |  | ||||||
| ## Run |  | ||||||
| 
 |  | ||||||
| Run locally with minikube: |  | ||||||
| 
 |  | ||||||
| ```sh |  | ||||||
| $ make minikube-run EXTRA_ARGS='--minikube --local' |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ## Testing | ## Testing | ||||||
| 
 | 
 | ||||||
| Run unit tests: | Run unit tests: | ||||||
| 
 | 
 | ||||||
| ```sh | ```bash | ||||||
| $ make test | make test | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Run e2e tests with minikube: | Run e2e tests with minikube: | ||||||
| 
 | 
 | ||||||
| ```sh | ```bash | ||||||
| $ make minikube-run | make minikube-run | ||||||
| $ eval $(minikube docker-env) | eval $(minikube docker-env) | ||||||
| $ make docker-build | make docker-build | ||||||
| $ make e2e E2E_IMAGE=<docker-image-builded-locally> | make e2e E2E_IMAGE=jenkins-operator | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| **Note:** running all tests requires: |  | ||||||
| - [docker][docker_tool] version 17.03+ |  | ||||||
| - [kubectl][kubectl_tool] version v1.10.0+ |  | ||||||
| - [minikube][minikube] version v0.30.0+(preferred Hypervisor - [virtualbox][virtualbox]) |  | ||||||
| 
 |  | ||||||
| See the project [README][jenkins-operator] for more details. | See the project [README][jenkins-operator] for more details. | ||||||
| 
 | 
 | ||||||
|  | ## Hacks | ||||||
|  | 
 | ||||||
|  | ### `pkg/apis/virtuslab/v1alpha1/jenkins_types` has changed | ||||||
|  | 
 | ||||||
|  | Generate deepcopy using operator-sdk: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | operator-sdk generate k8s  | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | output should be simillar to: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | INFO[0000] Running code-generation for Custom Resource group versions: [virtuslab:v1alpha1, ]  | ||||||
|  | Generating deepcopy funcs | ||||||
|  | INFO[0001] Code-generation complete. | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Getting Jenkins URL and basic credentials | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | minikube service jenkins-operator-example --url | ||||||
|  | kubectl get secret jenkins-operator-credentials-example -o yaml | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Install custom plugins | ||||||
|  | 
 | ||||||
|  | Extend `initBashTemplate` in `jenkins-operator/pkg/controller/jenkins/configuration/base/resources/scripts_configmap.go`: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | touch {{ .JenkinsHomePath }}/plugins.txt | ||||||
|  | cat > {{ .JenkinsHomePath }}/plugins.txt <<EOL | ||||||
|  | credentials:2.1.18 | ||||||
|  | ssh-credentials:1.14 | ||||||
|  | job-dsl:1.70 | ||||||
|  | git:3.9.1 | ||||||
|  | mask-passwords:2.12.0 | ||||||
|  | workflow-cps:2.61 | ||||||
|  | workflow-job:2.30 | ||||||
|  | workflow-aggregator:2.6 | ||||||
|  | EOL | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| [dep_tool]:https://golang.github.io/dep/docs/installation.html | [dep_tool]:https://golang.github.io/dep/docs/installation.html | ||||||
| [git_tool]:https://git-scm.com/downloads | [git_tool]:https://git-scm.com/downloads | ||||||
| [go_tool]:https://golang.org/dl/ | [go_tool]:https://golang.org/dl/ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue