Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lqss11/mavenci-k8scd-jenkinspipeline

Java maven continuous integration and kubernetes continious deployment on a test kind cluster with jenkins pipeline.
https://github.com/lqss11/mavenci-k8scd-jenkinspipeline

cicd java jenkins k8s-cluster k8s-deployment maven

Last synced: 1 day ago
JSON representation

Java maven continuous integration and kubernetes continious deployment on a test kind cluster with jenkins pipeline.

Awesome Lists containing this project

README

        

# MavenCI-K8sCD-JenkinsPipeline
Java maven continuous integration and kubernetes continious deployment with jenkins pipeline.
* Continuous Integration: [![Build](https://github.com/LQss11/MavenCI-K8sCD-JenkinsPipeline/actions/workflows/docker-env.yaml/badge.svg?branch=main)](https://github.com/LQss11/MavenCI-K8sCD-JenkinsPipeline/actions/workflows/docker-env.yaml)
## Qick Start
You have two options to run the application:
If you already have a kubernetes cluster setup ready and running properly you can start the stack directly using the `deploy.sh` an `purge.sh` scripts and make sure to create the proper docker image for the jenkins deployment by running:
```sh
# Make sure to run this at the same level of the compose file
docker build --build-arg MAVEN_V=3.5.4 -t lqss/jenkins -f ./jenkins/dockerfile .
```

If you only have docker installed and you want to check your stack you can follow the next commands.

start the app by running:
```sh
docker-compose up -d --build
```
> make sure you have docker and docker-comoose are installed on your host machine!

## Create kind test cluster
in order to create kind cluster you will need to run the script and it will ask you to specify how many control-plane(managers) and worker nodes you need:
```sh
docker exec -it kind-cluster /bin/bash -c "./content/scripts/cluster-setup.sh"
```
you can make sure that the cluster is working properly you can run to test a deployment:
```sh
docker exec -t kind-cluster /bin/bash -c "./content/scripts/deploy.sh"
```
Before stopping the stack you must need to remove the kind cluster containers created on your host machine for now by running:
```sh
docker exec -t kind-cluster /bin/bash -c "kubectl delete -f ./content/stack/devops-cicd/namespace.yaml" # Delete deployed resources by specified ns
docker exec -it kind-cluster kind delete cluster --name k8s-cluster # TODO add task on SIGTERM
```
you can then stop the docker compose stack by running:
```sh
docker-compose down
```
## Jenkins Groovy Scripts
You can find the groovy scripts used in **./cluster/content/jenkins-scripts** directory:

- init.groovy:
1. will setup Initial username and password using env variables (you can change .env variables to update admin username and password).
2. Associate the created user to become admin.
3. Checking logged-in users can do anything checkbox.
4. Enabling slave master access control.
5. Setting default URL
- dockerhub-cred.groovy
1. Setup dockerhub init credentials.