In this weeks blog post we'll be covering Jenkins. If you've been following my journey so far you'll notice I've been looking into the world of Dev Ops. A term I've come across frequently is the idea of CI/CD. Jenkins can be used to implement CI/CD, it's the leading open source automation server. With the ability to provide you with 1000's of different plugins to suit your needs.
What is CI/CD?
CI stands for continuous integration - the idea of Continuous Integration (CI) is the idea that you and your team would commit your code little and often in some form of repository (eg git). Each developer would have their own branch and then commit their changes into a shared version. When they commit their code it will trigger an automated build to grab the latest code and then be able to build, test and validate the full repo. The job of a CI server could be to notify you of errors should any be encountered. Say you have been working on something for 6 months and another developer has also been working on something else- when it comes to you both checking in your changes at the same time you might find your code is highly incompatible- you have all types of conflicts left right and centre because your code as so many differences. It's now someone's job to go in and resolve all these conflicts manually (Known as Merge Hell!). So you can see with CI has become very popular!
CD stands for continuous development/delivery. Continuous Delivery gives you the ability to automate your release process and also deploy your application at any given time by clicking a button. Continuous Development goes one step further than continuous delivery by completely automating the process- there is no human interaction what's so ever. Through your code pipelines software is automatically released to production (as long as it passes the relevant tests).
Install Jenkins on your local PC using docker
in this example we'll be using an ubuntu terminal to install. But if your using windows you can follow the same steps by running powershell as admin and removing the word sudo from the commands.
1.) You'll need to pull down the latest Jenkins file to do this run the following:
Sudo Docker pull jenkins/jenkins
![](https://static.wixstatic.com/media/7a082c_c7a58657438d4784bd2c3240ac79a85d~mv2.png/v1/fill/w_726,h_64,al_c,q_85,enc_avif,quality_auto/7a082c_c7a58657438d4784bd2c3240ac79a85d~mv2.png)
2.) You can now run jenkins by running the following command
sudo docker run -d --name=Jenkins -p 8080:8080 -p 50000:50000 -v jenkins-data:/var jenkins/jenkins
Just to explain the command above
run -d allows you to run the container in the background
--Name is just the name of the container you want to call this
-P lists the post you want to expose
-V creates a volume called -jenkins-data
At the end we reference the image name with is Jenkins
3.) To verify that Jenkins is up and running run the following
Docker PS
![](https://static.wixstatic.com/media/a27d24_e7a64119089e467dadaf764b1b1140ac~mv2.jpg/v1/fill/w_980,h_68,al_c,q_80,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_e7a64119089e467dadaf764b1b1140ac~mv2.jpg)
4.) In your local browser type in http://localhost:8080 which will advise you that it needs a password to unlock jenkins
![](https://static.wixstatic.com/media/7a082c_06ab05a2801d47e4904076f5fc566a0f~mv2.png/v1/fill/w_853,h_396,al_c,q_85,enc_avif,quality_auto/7a082c_06ab05a2801d47e4904076f5fc566a0f~mv2.png)
5.) To retrieve this password to paste into your web browser type in the following:
sudo docker exec Jenkins cat /var/jenkins_home/secrets/initialAdminPassword
![](https://static.wixstatic.com/media/7a082c_676232639e1f41989fd57dfcc8eaa682~mv2.png/v1/fill/w_874,h_44,al_c,q_85,enc_avif,quality_auto/7a082c_676232639e1f41989fd57dfcc8eaa682~mv2.png)
Copy the password in to the box seen previously in step 4
6.) This will bring you into a screen which will give you the option to install plugins> click on install suggested plugs
![](https://static.wixstatic.com/media/7a082c_2e135a587fc749b0aba2ad256727f247~mv2.png/v1/fill/w_980,h_595,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/7a082c_2e135a587fc749b0aba2ad256727f247~mv2.png)
!Please note if you get an error with downloading the plugins please make sure you have used jenkins/jenkins rather than just jenkins for the repo (see step 1)
7.) It will then advise you to create your first admin user. Fill out the details required and click save and continue
8.) It'll then ask you if you want to customise your jenkins URL for now leave this on the default
9.) Welcome- you'll now see the Jenkins Dashboard!
![](https://static.wixstatic.com/media/7a082c_8f50d83cd3104e038018deeca770895b~mv2.png/v1/fill/w_949,h_577,al_c,q_90,enc_avif,quality_auto/7a082c_8f50d83cd3104e038018deeca770895b~mv2.png)
And there we have it! We have jenkins installed. Watch this space as there will be another blog post up soon in regards to creating our very own jobs to run in Jenkins.
Yorumlar