Exploring Jenkins

Exploring Jenkins
ibnu gunawan prayogo

Ibnu Gunawan P

Tue, 22 2021, 11:39:00 pm

Table Of Content

Exploring Jenkins

Jenkins is a powerful open-source automation server, crafted using the versatile Java programming language. One of its primary purposes is to facilitate Continuous Integration and Continuous Delivery, commonly referred to as CI/CD processes. In simpler terms, Jenkins is your trusty sidekick for automating tasks such as testing, building, and deployment.

# Installing Jenkins

For the installation process, I've prepared a nifty bash script that makes setting up Jenkins a breeze. Just follow these simple steps:

$ git clone https://github.com/notme1001/jenkins-run.git && cd jenkins-run
$ ./test.sh
      __               __    __                                              
     |__| ____   ____ |  | _|__| ____   ______         _______ __ __  ____   
     |  |/ __ \ /    \|  |/ /  |/    \ /  ___/  ______ \_  __ \  |  \/    \  
     |  \  ___/|   |  \    <|  |   |  \___ \   /_____/  |  | \/  |  /   |  \ 
 /\__|  |\___  >___|  /__|_ \__|___|  /____  >          |__|  |____/|___|  / 
 \______|    \/     \/     \/       \/     \/                            \/  
Simple Install Jenkins With one command, Select your Linux distribution for installation:
 Date: Tuesday, March 23, 2021, 05:49:33 AM  WIB
 1 - CentOS 7
 2 - Ubuntu or Debian
 3 - Example Jenkinsfile
Enter your selection:

Choose the Linux distribution used on your server or locally. Once the installation is complete, you can access Jenkins by opening the Jenkins URL with the default port, which is 8080. http://ip-server:8080.

Configuring Jenkins

  • To unlock Jenkins, run the command below, and make sure to copy the password key to access Jenkins.
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword


  • Continue by selecting "Install suggested plugins."


  • Set your username and password.


  • Configure the URL address for Jenkins.


# Usage

Integrating Jenkins with GitHub allows automatic deployment when pushing to a specific branch.

  • Create a new job, provide a job name, and select "Pipeline."


  • In the General tab, check "GitHub Project" and enter the GitHub repository URL you intend to use.


  • In the Build Triggers tab, check "GitHub hook trigger for GITScm polling."


  • In the Pipeline tab, configure it as shown below, and save the Pipeline configuration.


Explanation of Pipeline Configuration

  1. We set the environment variable to include the path to Docker Compose, which is useful if you're using Docker for deployment. If not, you can skip this part.
  2. The "stages" section defines the steps Jenkins will take. Here, I've created three stages: "Build," "Test," and "Deploy," each with corresponding actions.
  3. The "sh" command is used to execute Linux commands. In this example, it lists the contents of the workspace directory.
  • At this point, you can test the build process in Jenkins.


  • Here's the result of the build process in Jenkins.


  • Witness the integration of Jenkins and GitHub: Whenever you push to the repository, Jenkins automatically initiates the build by pulling the repository and running the Jenkinsfile.



# Author's Note

Easy, right?

In reality, Jenkins can do more than what I've described above. For instance, it can send messages after the build process using a Telegram bot or email. But for now, that's all I can provide. Hopefully, you find it useful.