CI CD
unpublished draft
CICDJenkinsArgocd
CI
Jenkins#
Fundamential
- https://www.youtube.com/watch?v=nCKxl7Q_20I
- https://www.youtube.com/watch?v=pMO26j2OUME&list=PLy7NrYWoggjw_LIiDK1LXdNN82uYuuuiC
Using environment variable
- https://www.youtube.com/watch?v=qz9I3v0PDeY
- https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
- https://docs.cloudbees.com/docs/admin-resources/latest/automating-with-jenkinsfile/string-interpolation
- https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-AntScripts
Docker build slave Docker bootstraped with image not recommended Build .Net core Jenkins(not recommended anymore since we containerize era coming in)
- https://medium.com/southworks/creating-a-jenkins-pipeline-for-a-net-core-application-937a2165b073
- https://www.jenkins.io/doc/pipeline/steps/dotnet-sdk/
Docker Jenkins
- https://www.jenkins.io/doc/book/pipeline/docker/
- https://www.jenkins.io/doc/book/pipeline/syntax/#agent-parameters
Plugin that need
- Config File Provider
- Docker
- Docker Pipeline
- BlueOcean
- SSH Agent
- .NET SDK Support
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#
Remember to create jenkins namespace first.
Github webhook
Remember to specify the webhook endpoint url as http://domain.com/github-webhook/, not http://domain.com/github-webhook
CD
Kustomize#
Place kustomize binary under /usr/local/bin
For replacement variable kustomize
Testing
# for testing
kustomize build ./dev > ./kustomization/dev-manifest.yaml
kubectl apply -k ./dev
Helm#
Argo CD#
Installation
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
ArgoCD config map manual,
after modify cm, run kubectl -n argocd rollout restart deploy/argocd-repo-server
for argocd to take effect.