Skip to content

bharatrajtj/jenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

JenKins CICD Pipeline

1. Create a large EC2 t2.large instance with 2CPU 8GB RAM![image](https://github.com/bharatrajtj/jenkins/assets/65009556/e11b2c9c-9fd8-4bc1-b397-c5fbe1d85647)
  1. Git clone the repository image

  2. Install Java, a pre requisite for Jenkins image

  3. Run the jenkins install script image

  4. Jenkins run HTTP on port 8080 image

  5. Configure inbound traffic rules in your EC2 instance to allow inbound traffic to the instance image

  6. Cat /var/lib/jenkins/secrets/initialAdminPassword in your terminal to get the password image image

  7. After installling the necessary plugins and finish you will reach the Jenkins Dashboard image

  8. Select New item to create Jenkins Pipeline and select Pipeline image

  9. Select pipeline script from SCM. We are using Git as our Source Code Manager for this project. The repository URL is https://github.com/bharatrajtj/jenkins image

  10. Script path is the path directory where the Jenkins file is located within the repository. The jenkinsfile and can be located in any path and jenkins file can be named as you wanted. image

  11. Go to Manage Jenkins > Plugins> Available plugins, search and install docker pipeline plugin to run docker as agents image image

  12. Go to Manage Jenkins > Plugins> Available plugins, search and install SonarQube Scanner for code quality inspection image

  13. Add new user named SonarQube in the EC2 instance and switch to the new user image

  14. Download the sonar zip file wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.4.0.54424.zip image

  15. Install apt install unzip to unzip your zip file in the root user image

  16. Switch to sonarqube user and run unzip * image image

  17. Grant permission to the folders image

  18. Go to path depending upon your instance architecture image

  19. Run ./sonar.sh start to execute your SonarQube server image

  20. SonarQube will run at port 9000, configure inbound rules to allow traffic from port 9000 image

  21. Enter ec2 IP address:9000 in browser to reach sonarqube server page. Default user name and password for Sonar Qube is admin image image

  22. In SonarQube page go to myAccount>Security and generate a token image

  23. In Jenkins Page go to ManageJenkins>Credentials>System>GlobalCredentials>AddCredentials image image

  24. Install Docker in root user image

  25. Grant Jenkins and Ubuntu user permission to access docker daemon and restart docker image

  26. Restart Jenkins to make sure the plugins installed will function properly. To restart jenkins after port number enter /restart image

  27. Running Minikube on my windows local machine through docker container in powershell image

  28. Installing ArgoCD operator to manage life cycle of Kubernetes controller – ArgoCD in minikube https://operatorhub.io/operator/argocd-operator-helm image

  29. Configure dockerhub and GIThub credentials to Jenkins image

  30. For GitHub go to Settings—personal access tokens—Generate New token (classic) and create the token image

  31. In Jenkins use secret text kind for github credential and restart Jenkins once credentials are created image image

  32. Modified sonarqube IP address, docker repository and Github repository values in the source code and commit changes image

  33. Build the Jenkins Pipeline image image

  34. SonarQube report for code analysis image

  35. Docker registry where the image generated has been pushed image image

  36. Update the docker image name in the deployment yml image

  37. Create a yml file in your local machine and apply this content to install ArgoCD controller image image

  38. Make sure the argocd operator pods are created image

  39. Edit the service type from Cluster IP to NodePort for example-argocd-server image image image

  40. Get URL to access the service through web image

  41. Get the password to argocd account by getting into argocd-cluster secret image

  42. Decode your base 64 encrypted secret image

  43. Enter the credentials in ArgoCD web interface image image

  44. Create application in argocd and configure required information image image image image

  45. The spring boot application has been deployed in our minikube cluster through argocd image

  46. Edited the deployment image to nginx in the minikube image image

  47. ArgoCD recognize that the image in manifest yml is different from the image executing on minikube cluster it starts to rollback to image mentioned in the manifest image image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published