Gear Up with Jenkins!

Saranki Magenthirarajah
5 min readMar 22, 2020
[Source:http://www.quickmeme.com/img/2d/2d4ccdc6095a54dff921438af13b403e197d6467b1a10f1612fba144fd88ffdc.jpg]

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 😰?

[Source: https://media.giphy.com/media/Dd76QxXlhsWCk/giphy.gif]

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.

[Source: https://jenkins.io/images/logo-title-opengraph.png]

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
[Fig 1: Install Jenkins via Homebrew]

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.

[Fig 2: Setting permissions to file/folder using chown command]

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.

jenkins
[Fig 3: Administrator Password will be generated]

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.

[Fig 4: Unlock Jenkins UI]

As the next step click on “Install suggested plugins” to add the plugins that are extending Jenkins for a better experience.

[Fig 5: Install Plugins]

Now the plugins will be added as follows.

[Fig 6: Adding the plugins]

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.

[Fig 7: Create First Admin User UI]

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.

[Fig 8: Jenkins URL configuration]

Now you are all set to use the Jenkins! Click on the “Start using Jenkins” button.

[Fig 9: Jenkin is Ready UI]

You will end up on the Jenkins home page as follows.

[Fig 10: Jenkins home page]

What are you waiting for? Let’s get started!!!

Summary

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.

Happy Deployment…!!!

[Source: https://media1.tenor.com/images/475f0154c049721e4b4ef126749e7aac/tenor.gif?itemid=3558481]

--

--