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
|
||||
|
||||
Kubernetes native Jenkins operator
|
||||
Kubernetes native Jenkins operator.
|
||||
|
||||
## Developer guide
|
||||
|
||||
Can be found [here][developer_guide]
|
||||
Can be found [here][developer_guide].
|
||||
|
||||
## TODO
|
||||
|
||||
- send Kubernetes events
|
||||
Common:
|
||||
- simple library for sending Kubernetes events
|
||||
- implement Jenkins.Status in custom resource
|
||||
|
||||
Base configuration:
|
||||
- install configuration as a code Jenkins plugin
|
||||
|
|
@ -17,11 +19,11 @@ Base configuration:
|
|||
- disable insecure options
|
||||
|
||||
User configuration:
|
||||
- AWS s3 restore backup job
|
||||
- AWS s3 backup job
|
||||
- create and run seed jobs
|
||||
- apply custom configuration by configuration as a code Jenkins plugin
|
||||
- trigger backup job before pod deletion
|
||||
- user reconciliation loop (work in progress)
|
||||
- configure seed jobs and deploy keys (work in progress)
|
||||
- e2e tests for seed jobs
|
||||
- backup and restore for Jenkins jobs running as standalone job
|
||||
- trigger backup job before pod deletion using preStop k8s hooks
|
||||
- verify Jenkins configuration events
|
||||
|
||||
[developer_guide]:doc/developer-guide.md
|
||||
|
|
@ -3,70 +3,102 @@
|
|||
This document explains how to setup your dev environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [dep][dep_tool] version v0.5.0+
|
||||
- [git][git_tool]
|
||||
- [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.
|
||||
|
||||
## Vendor dependencies
|
||||
|
||||
Run the following in the project root directory to update the vendored dependencies:
|
||||
|
||||
```sh
|
||||
$ cd $GOPATH/src/github.com/VirtusLab/jenkins-operator
|
||||
$ make go-dependencies
|
||||
```bash
|
||||
mkdir -p $GOPATH/src/github.com/VirtusLab
|
||||
cd $GOPATH/src/github.com/VirtusLab/
|
||||
git clone git@github.com:VirtusLab/jenkins-operator.git
|
||||
cd jenkins-operator
|
||||
make go-dependecies
|
||||
```
|
||||
|
||||
## Build the Operator
|
||||
## Build and run
|
||||
|
||||
Build the Operator `jenkins-operator` binary:
|
||||
Build and run `jenkins-operator` locally:
|
||||
|
||||
```sh
|
||||
$ make build
|
||||
```bash
|
||||
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
|
||||
$ make build
|
||||
$ make docker-build
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
Run locally with minikube:
|
||||
|
||||
```sh
|
||||
$ make minikube-run EXTRA_ARGS='--minikube --local'
|
||||
```bash
|
||||
kubectl apply -f jenkins-operator/deploy/crds/virtuslab_v1alpha1_jenkins_cr.yaml
|
||||
kubectl get jenkins -o yaml
|
||||
kubectl get po
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Run unit tests:
|
||||
|
||||
```sh
|
||||
$ make test
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
Run e2e tests with minikube:
|
||||
|
||||
```sh
|
||||
$ make minikube-run
|
||||
$ eval $(minikube docker-env)
|
||||
$ make docker-build
|
||||
$ make e2e E2E_IMAGE=<docker-image-builded-locally>
|
||||
```bash
|
||||
make minikube-run
|
||||
eval $(minikube docker-env)
|
||||
make docker-build
|
||||
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.
|
||||
|
||||
## 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
|
||||
[git_tool]:https://git-scm.com/downloads
|
||||
[go_tool]:https://golang.org/dl/
|
||||
|
|
|
|||
Loading…
Reference in New Issue