2.3 KiB
2.3 KiB
Developer guide
This document explains how to setup your development environment.
Prerequisites
- operator_sdk
- git
- go version v1.12+
- minikube version v1.1.0+ (preferred Hypervisor - virtualbox)
- docker version 17.03+
Clone repository and download dependencies
mkdir -p $GOPATH/src/github.com/jenkinsci
cd $GOPATH/src/github.com/jenkinsci/
git clone git@github.com:jenkinsci/kubernetes-operator.git
cd kubernetes-operator
make dep
Build and run
Build and run jenkins-operator locally:
make build && make minikube-run EXTRA_ARGS='--minikube --local'
Once minikube and jenkins-operator are up and running, apply Jenkins custom resource:
kubectl apply -f deploy/crds/jenkinsio_v1alpha1_jenkins_cr.yaml
kubectl get jenkins -o yaml
kubectl get po
Testing
Run unit tests:
make test
Run e2e tests with minikube:
make start-minikube
eval $(minikube docker-env)
make e2e
Run the specific e2e test:
make e2e E2E_TEST_SELECTOR='^TestConfiguration$'
Tips & Tricks
Building docker image on minikube (for e2e tests)
To be able to work with the docker daemon on minikube machine run the following command before building an image:
eval $(minikube docker-env)
When pkg/apis/jenkinsio/v1alpha1/jenkins_types.go has changed
Run:
make deepcopy-gen
Getting Jenkins URL and basic credentials
minikube service jenkins-operator-http-example --url
kubectl get secret jenkins-operator-credentials-example -o 'jsonpath={.data.user}' | base64 -d
kubectl get secret jenkins-operator-credentials-example -o 'jsonpath={.data.password}' | base64 -d