Auto Deployments with Jenkins

Jenkins: what is it?

This open-source, self-contained server automates all sorts of steps related to building, testing, deploying, and delivering software.
Depending on your platform, Jenkins can be installed using native system packages, through Docker, or running standalone on any machine with a Java Runtime Environment (JRE).

Installing Jenkins

In conventional Jenkins setup, Jenkins is run as a stand-alone application, using its own process along with the integrated Java servlet container/application server (Jetty).

Alternatively, Jenkins can be deployed as a Java servlet within Apache Tomcat or GlassFish.

It is an application platform for running applications in an isolated environment, called a “container” (or Docker container). Downloading an application like Jenkins as a read-only “image” (or Docker image) enables it to be run within a Docker container. It is, therefore, possible to think of a Docker container as an instance of a Docker image running. In this sense, images are stored permanently more or less (for example, until updates are published), while containers are stored temporarily. 

Docker

A Docker image (for any application like Jenkins) can be run on any supported operating system (macOS, Linux, and Windows) or cloud service (AWS, Azure) running Docker.

Kubernetes (K8s)

A containerized application can be deployed, scaled, and managed automatically with Kubernetes (K8s).
Jenkins gains a new automation layer with Kubernetes. By using Kubernetes, you can make sure that your servers and underlying infrastructure are not overloaded. By orchestrating container deployment, Kubernetes ensures that Jenkins always has the appropriate amount of resources. In this section, we will describe several options for installing/running Jenkins on Kubernetes.

Linux

Several Linux distributions offer Jenkins installers.

a.The Debian/Ubuntu distributions

b.The Fedora
c.Red Hat and CentOS

Apple Mac OS

The macOS installer for Jenkins is maintained outside the Jenkins project. 

WAR Files

Any operating system or platform that supports Jenkins’ Java-based Web application archive (WAR) file can be installed with Jenkins.

Windows 

Jenkins can be installed on Windows using the Jenkins Windows installer. A 64 bit JVM will be selected by the user when Jenkins is installed as a service through that program. It is very important to keep in mind that Jenkins must have permission to run as a service for an account to run Jenkins.

FreeBSD

Pkg, FreeBSD’s standard package manager, can be used to install Jenkins.

Initial Settings

You can make most Jenkins configuration changes from the Jenkins user interface or through the Configuration as Code plugin. You can only modify some configuration values during Jenkins’ startup.

 

Jenkins Pipeline 

Jenkins Pipeline (or simply Pipeline) is a suite of plugins for implementing and integrating continuous delivery pipelines with Jenkins.

Continuous delivery (CD) pipelines automate the process of getting software from version control to your users and customers. The process of releasing changes to your software (committed in source control) is complex. A build is defined as the method of building software in a reliable and repeatable way, along with the process of progressing the build (or “build”) through various stages of testing and deployment.

With Pipeline, you can model simple-to-complex delivery pipelines “as code” using the Pipeline domain-specific language (DSL). Pipelines can be defined in the web UI or with a Jenkinsfile, although it’s generally recommended to define them in a Jenkinsfile and check them into source control.

Scripted versus declarative pipelines

There are two types of syntax for Jenkinsfiles: declarative and scripted.

Scripted and declarative pipelines differ fundamentally. Scripted Pipeline syntax has been replaced by Declarative Pipeline syntax, which provides more structured syntax and makes writing and reading Pipelines code easier. Individual components of a syntactic phrase (or “Steps”) inserted into a Jenkinsfile, however, are common to both Declarative and Scripted Pipelines.

What is the purpose of the Pipeline?

Jenkins is, at its core, an automation engine that supports a variety of automation patterns. Adding Pipeline to Jenkins adds a powerful set of automation that can be used to automate anything from simple continuous integration to robust continuous delivery pipelines. The following Pipeline features can be utilized by users by modeling a series of related tasks:

  • Pipelines are implemented as code and stored in source control, giving teams the ability to edit, review, and iterate upon them.
  • Jenkins controller restarts can be planned and unplanned, which makes pipelines durable.
  • The pipeline can be paused to wait for human input or approval before continuing to run.
  • In addition to supporting complex real-world CD requirements, pipelines are versatile in that they can be forked/joined, looped, and run in parallel.
  • The Pipeline plugin offers multiple options for integration with other plugins and supports custom extensions to its DSL.

Pipeline makes Freestyle Jobs a first-class citizen in Jenkins, allowing them to be chained together to perform sequential tasks. In keeping with Jenkins’ core value of extensibility, Pipeline can also be extensible, both via Pipeline Shared Libraries and through plugin development.

Blue Ocean

Jenkins’ user experience is rethought by Blue Ocean. Blue Ocean is specifically designed for Jenkins Pipeline, but it is also compatible with freestyle jobs. It reduces clutter and ensures that all team members are on the same page. Blue Ocean has the following key features:

  • A visual representation of continuous delivery (CD) pipelines, which allows a fast and intuitive understanding of the state of your CD pipeline.
  • Pipeline editors provide you with a visual and intuitive way to create Pipelines.
  • Roles are customized to the needs of each individual.
  • Interventions and/or issues can be pinpointed precisely when they occur. As a result, exception handling is enabled and productivity is increased by showing where attention is required.
  • The integration between Bitbucket and GitHub allows developers to increase their productivity through branch-based development and pull requests.

Leave a Reply

Your email address will not be published.