CI CD

unpublished draft
CICDJenkinsArgocd

CI

Jenkins#

Fundamential

Using environment variable

Docker build slave Docker bootstraped with image not recommended Build .Net core Jenkins(not recommended anymore since we containerize era coming in)

Docker Jenkins

Plugin that need

Default environment: [Jenkins URL]/env-vars.html

Reset build number#

Go to http://your-jenkins-server/script then run

item = Jenkins.instance.getItemByFullName("your-job-name-here")
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build -> build.delete() }
item.updateNextBuildNumber(1)

Docker stand alone setup#

Docker setup - Require docker to be installed on machine
# -u 0 mean run the same jenkins user permission as root user.
docker run -u 0 -d --name local-jenkins -p 46000:8080 -p 50000:50000 -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v /opt/app_data/jenkins:/var/jenkins_home jenkins/jenkins:lts

Jenkins with k8s setup#

Tutorial here

Remember to create jenkins namespace first.

CD

Kustomize#

Place kustomize binary under /usr/local/bin

Some basic using

For replacement variable kustomize

Testing
# for testing
kustomize build ./dev > ./kustomization/dev-manifest.yaml
kubectl apply -k ./dev

Helm#

Tutorial

Argo CD#

Installation
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Furthur config to made

ArgoCD config map manual, after modify cm, run kubectl -n argocd rollout restart deploy/argocd-repo-server for argocd to take effect.


Khanh Nguyen

Web developer & .Net lover