Jenkins Agent

Jenkins Agent

In general, Jenkins uses the master-slave architecture to develop software. Jenkins agents are nothing, but probably you can say that Jenkins slaves are Jenkins agent.

 Jenkins agents are like a machine or Container, which connects with the Jenkins master to execute the build on his command.

Difference between top and stage level agent:

There is a slight difference between the top level and stage level Jenkins agent. These agents are used in the declarative pipeline process. The main difference between them is:

  1. The top-level section must be defined at the top of the pipeline block, but the stage level can be defined anywhere in the pipeline block.
  2. In the top-level agent, options are invoked after entering the agent, while in stage level, options are invoked before entering the agent.

Jenkins Remoting:

It is a library and executable java backlog used to establish the communication layer in the Jenkins tool. Jenkins remoting is mainly used in master-slave communications. It works on TCP/IP communication protocol, remote procedural calls, data streaming, class loading and many more.

Remoting library is used in establishing the connection between Jenkins master, JNLP and SSH agents with the help of TCP/IP protocol.

Docker:

Docker is a platform used to deliver software tools from company to market in the form of packages. These packages are known as containers. One Container keeps it separate from another container. They are joined with their software tool and their libraries.

Docker was found by Soloman Hykes in 2010, but it made its official debut in 2013, and this time, it got fully introduced in the market.

Jenkins with docker: without docker, you need to install some additional tools and different agents in Jenkins. Jenkins pipeline works very well with docker container.

Deploying Docker containers is very easy as you can deploy them on any physical machine and virtual machine. You can also deploy it on the cloud.

Python API:

Jenkins also supports python. You can also perform the same operation in python as you do in java with the help of python API. Internally python uses rest APIs to perform such operations. You need to install the Jenkins with the help of the pip command, and then you can import the Jenkins module from the Jenkins server to perform operations in python.

Write the following command on CMD:

                        $ pip install - -user python-Jenkins

                        $ python

Now, go in python idle and type the given statement:

            >>> from jenkins import Jenkins

            >>> help(Jenkins)

The above statement will show you all the magic functions classes and normal functions related to Jenkins. By using all these facilities you can easily perform operations with jenkins

You can also see other information like copyright, credit, license and many more by following the given structure:

                        >>> help(Jenkins)

                        >>> copyright(Jenkins)

                        >>> credits(Jenkins)

                        >>> license(Jenkins)

Get jobs from Jenkins using python API:

>>> from jenkins import Jenkins

>>> j = Jenkins(url = ‘http://YOUR_ENKINS_HOST_NAME’, username = ’YOUR_USERNAME’, password = ‘YOUR_API_TOKEN’)

>>> j.get_whoami()

>>> j.get_all_jobs()

Purpose of creating Blue Ocean:

  1. Make it easier for teams to use Jenkins.
  2. Easy access to jobs for every team member.
  3. Provide a better user interface.

Browser compatibility:

All the browsers are supportable for Jenkins, but there are some plug-ins that will not work properly with some browsers like:

Blue Ocean plug-in is not yet runnable in Internet explorer and AmigaOS. Blue Ocean's dashboard does not support these browsers at the current time.

Reporting bugs and feature request:

We use Jenkins JIRA for it.

Create a new account, browse in JIRA and login with your account, then create a new problem with the component >> blue ocean-plugin.

Jenkins in Future:

The future of Jenkins is very bright in the market. Even now, it comes in the most popular CI tool available in the market. It has great support from the developer's community. Although there are some cons of the Jenkins, sooner it will overcome them.

Continuous integration and continuous delivery have changed the model of the market in the last few years. The CI and CD was the new concept when Jenkins was introduced in the market, but it has made its own space in the market. Jenkins fully works on Continuous integration and continuous deployment method, so it becomes very popular among the developer in very little time after its release.