After a hectic day of work finally, the PRs got merged and deployed the changes to the QA environment, please note the process is done manually 😈 as it’s a startup and the things are yet to be settled down. What if you have missed implementing an important logic? Again from the beginning 😰?
Jenkins, the problem solver
Jenkins is a very popular open-source automation server that performs continuous integration and deployment done via executing jobs. Jobs are nothing but a set of predefined tasks. This can be achieved by connecting the version controlling system(E.g. GitHub, GitLab, BitBucket) with Jenkins. Every time a change takes place in the repository it triggers a pipeline of jobs and executes them.
For example, assume a scenario whereupon every successful PR merge, the relevant artifacts will be generated and be deployed in the QA environment. In this scenario, the successful PR merge is the trigger and the jobs would be generating the artifacts and deploying it in the QA environment. This is possible via Jenkins and it has made our lives much easier.
Even though this step by step guidance will be for MacOs it is still applicable for all the operating systems(OS). At the end of this blog, I have attached the resources to get the necessary installation files for various OS.
Install Jenkins in MacOs
Let’s see how we can install and get started with the Jenkins in MacOs.
Installing Jenkins in MacOs has been made very easy via Homebrew package manager. The steps to install Homebrew can be found in the brew link. Once you install the Homebrew open a terminal. Next, simply type the below command in the terminal.
brew install jenkins
In case if you come across any file/folder permission errors you can add the permissions using the “chown” command. An example has been provided below.
Once the relevant permissions are granted execute the “brew install jenkins” again and you will be able to successfully install the Jenkins.
As the next step, we have to run the Jenkins. Simply, execute the following command in the terminal.
Upon a successful startup of Jenkins, you will be given an admin password in the terminal and this can be viewed in /Users/<username>/.jenkins/secrets/initialAdminPassword. Please remember that this is used only for installation purposes and this needs to be changed during the process.
Now the Jenkins can be accessed via http://localhost:8080/ URL. You will be displayed with the following UI. In the administrator password input box, provide the generated password and click on the “Continue” button.
As the next step click on “Install suggested plugins” to add the plugins that are extending Jenkins for a better experience.
Now the plugins will be added as follows.
Next, you need to create an admin user account by providing the following details. You also can skip this and continue as the default admin.
Once you have successfully created the admin user you will be able to view the URL in which the Jenkins will be up and running. Even though you can edit this value, for best practices it is expected to keep the default value as it is.
As the final step, click on the “Save and Finish” button.
Now you are all set to use the Jenkins! Click on the “Start using Jenkins” button.
You will end up on the Jenkins home page as follows.
What are you waiting for? Let’s get started!!!
In a nutshell, this blog is about and intro to the well-known Jenkins and the setting up in your mac. For other OS users please visit https://jenkins.io/download/ to download Jenkins based on your OS type. Downloading and installing Jenkins is pretty much similar in all the OS. Once the installation is done the remaining steps in setting up Jenkins are the same for all the OS.
I hope this was a useful and quite straightforward blog on installing and setting up Jenkins in your local machines. Let’s discuss creating jobs and getting started with the actual CI/CD work with a practical example.