A simple guide to start using Jenkins

What is CI?

It is a software development practice where developers regularly integrate their code changes into a central repository.


1- Detect and address integration issues early in the development process.

2- Frequent Code integration.

3- Automated testing.

4- Rapid feedback.

5- Consistent Build process

6- Efficient Deployment

Jenkins Type Installations:

1- Install into a VM

2- Into the Cloud(AWS, Digital Ocean, Azure)

3- Vagrant

4- Docker Container

Installation example from Docker:

1- docker pull jenkins/jenkins

2- choose a home folder like ex: jenkins/jenkins_home

3- create into jenkins folder a docker-compose.yml

4- into jenkins folder run: docker-compose up -d

5- go to localhost:8080.

6- docker exec -ti jenkins bash to get into the container

7- cat url from login and paste the pass.

8- Install suggested plugins

9- Add user credentials

10- Start using jenkins

10.1 – docker-compose start or stop is the way to start the service

Architecture Jenkins:

      • Executable tasks that are supervised by Jenkins(Jobs)

      • Master and Slave:

    It is used for distributed builds and workload distribution. The jenkins master server manages the overall system, while Jenkins slave nodes carry out the build jobs. The master communicates instructions to the slaves, which then execute the tasks.

    This setup is beneficial for handling larger workloads, parallelizing builds, and distributing tasks across multiple machines, to improve efficiency and speed.

        • A job executor or job Agent: in Jenkins is a worker node that carries out the execution of build jobs. It handles the actual execution of tasks, such as compiling code, running tests, and packaging applications. Each job executor can handle one build at a time, and Jenkins can have multiple job executors to handle concurrent builds. (For example, if you have a Jenkins master server managing your builds, you can set up multiple Jenkins agents on different machines, such as a Windows server, a Linux server, and a macOS machine. When a build is triggered, Jenkins can delegate the tasks to these agents based on their availability and capabilities, enabling parallel execution and efficient resource utilization.)

      Let’s create the first Job:

      1- New Item: First Job

      2- Add params and description:

      Only add a description.

      3- Build steps: Execute a Shell

      4- Build (Jenkins is gonna to create a script in bash in a temporary file and executing it) -> console output and look for “Welcome to Jenkins”

      Let’s add some Parameters:

      1- Go to Configure

      2- Add a boolean, choose and string parameter:

      3- Now I can use those parameters into my script: 

      4- Then I need to choose Build with parameters from the main menu, and I have the parameters to use: 

      5- And after a build:

      All var were set and the Job is running ok.