From e7c55512a8dffe259e50d6bbd3f13b8a357b87a3 Mon Sep 17 00:00:00 2001 From: antoniaklja Date: Thu, 27 Dec 2018 18:17:54 +0100 Subject: [PATCH] Refactoring, additional tests and update README.md --- Makefile | 2 +- README.md | 41 ++- doc/developer-guide.md | 25 +- .../jenkins/configuration/user/validate.go | 30 ++- .../configuration/user/validate_test.go | 233 ++++++++++++++++++ pkg/controller/jenkins/jenkins_controller.go | 2 +- test/e2e/base_configuration_test.go | 8 +- test/e2e/jenkins.go | 8 +- test/e2e/user_configuration_test.go | 20 +- test/e2e/wait.go | 2 +- 10 files changed, 315 insertions(+), 56 deletions(-) create mode 100644 pkg/controller/jenkins/configuration/user/validate_test.go diff --git a/Makefile b/Makefile index 38630171..a16ddce2 100644 --- a/Makefile +++ b/Makefile @@ -332,7 +332,7 @@ endif start-minikube: ## Start minikube @echo "+ $@" @minikube status && exit 0 || \ - minikube start --kubernetes-version $(MINIKUBE_KUBERNETES_VERSION) --vm-driver=$(MINIKUBE_DRIVER) + minikube start --kubernetes-version $(MINIKUBE_KUBERNETES_VERSION) --vm-driver=$(MINIKUBE_DRIVER) --memory 2048 .PHONY: bump-version BUMP := patch diff --git a/README.md b/README.md index 685f43ad..a404085e 100644 --- a/README.md +++ b/README.md @@ -76,23 +76,38 @@ Jenkins operator will automatically configure and trigger Seed Job Pipeline for ## TODO Common: -- simple library for sending Kubernetes events using one common format -- decorate Jenkins API client and add more function for handling jobs e.g. Ensure, CreateOrUpdate +* VirtusLab docker registry (in-progress) +* simple library for sending Kubernetes events using one common format +* decorate Jenkins API client and add more function for handling jobs e.g. Ensure, CreateOrUpdate +* documentation [github pages with Hugo](https://gohugo.io/): + * Installation + * Getting Started + * Plugins + * Seed jobs + * Backup and Restore + * How it works + * architecture + * CR definition + * K8s events + * Debugging + * Base and User configuration + * Contributing +* VirtusLab flavored Jenkins [theme](http://afonsof.com/jenkins-material-theme/) Base configuration: -- install configuration as a code Jenkins plugin -- handle Jenkins restart when base configuration has changed -- install and configure Kubernetes plugin -- e2e pipelines using Kubernetes plugin -- Jenkins hardening, disable insecure options +* install configuration as a code Jenkins plugin +* handle Jenkins restart when base configuration has changed +* install and configure Kubernetes plugin (in-progress) +* e2e pipelines using Kubernetes plugin +* Jenkins hardening, disable insecure options User configuration: -- user reconciliation loop with CR validation (work in progress) -- configure seed jobs and deploy keys (work in progress) -- e2e tests for seed jobs (work in progress) -- backup and restore for Jenkins jobs running as standalone job -- trigger backup job before pod deletion using preStop k8s hooks -- verify Jenkins configuration events +* ~~user reconciliation loop with CR validation~~ +* ~~configure seed jobs and deploy keys~~ +* ~~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 [job-dsl]:https://github.com/jenkinsci/job-dsl-plugin diff --git a/doc/developer-guide.md b/doc/developer-guide.md index acd9533a..e867d9bb 100644 --- a/doc/developer-guide.md +++ b/doc/developer-guide.md @@ -1,6 +1,6 @@ # Developer guide -This document explains how to setup your dev environment. +This document explains how to setup your development environment. ## Prerequisites @@ -28,7 +28,7 @@ Build and run `jenkins-operator` locally: make build && make docker-build && make minikube-run EXTRA_ARGS='--minikube --local' ``` -Once minikube and `jenkins-operator` are up and running, apply CR file: +Once `minikube` and `jenkins-operator` are up and running, apply CR file: ```bash kubectl apply -f jenkins-operator/deploy/crds/virtuslab_v1alpha1_jenkins_cr.yaml @@ -44,7 +44,7 @@ Run unit tests: make test ``` -Run e2e tests with minikube: +Run e2e tests with `minikube`: ```bash make minikube-run @@ -64,7 +64,6 @@ Run: make deepcopy-gen ``` - ### Getting Jenkins URL and basic credentials ```bash @@ -72,24 +71,6 @@ 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 <