JenKins: Way to DevOps
Before going directly to
Jenkins, let us try to understand what is DevOps....... As per
my understanding DevOps is nothing but an day to day pratice which is used to
address the gap between Developers and Operations i.e. DevOps makes Developers and Operations to
work in tightly coupled development as well as production
envrioment.
DevOps= Developer +
Operational
DevOps= Development
Environment + Production Environment
Thus, from the above
disucssion, it is very much clear that DevOps practice leads to
Continuous Integration + Delivery + Deployment.
But do you think, the above definition is sufficient to understand the DevOps......i think NO, DevOps is not only limited to Continuous Integration, Continuous Delivery, Continuous Deployment, extening to this DevOps in depth, it includes various phases which includes, PLAN -- CODE -- BUILD -- TEST -- INTEGRATE -- DEPLOY -- OPERATE -- MONITOR.
According to DevOps
pratices, the workflow in software development and delivery is divided into
above mentioned 8 phases ( Starts from Plan to Test and then Integrate to
Monitor).
Developer one who
practices above 8 phases continuously in their day to day activtiy, leads to
Continuous Integration + Continuous Delivery + Continuous Deplpoyment, which
nothing but DevOps practice.
Now after understanding,
that how DevOps works and how it can leads any software product to continuous
deployment to the production enviroment, now let us understand to how to
achieve the DevOps Practice.
Towards implementation
of DevOps (JENKINS)
Jenkins is nothing but
free and open source automation server,it automates almost every part of SDLC
(Software Development Life Cycle) which mainly includes Develop, Build, Test,
Deploy, with providing the functionality of Continuous Integration, Continuous
Delivery, Continuous Deployment.
Let us try to understand
how Jenkins Pipeline works...........
Basically, Jenkins works
in pipeline manner, in abstract way we can say that Jenkins Pipeline is a suite
of Jenkins Features, installed as plugins, which helps us to enable
implementation and integration of continuous delivery
pipeline into Jenkins.
In the above figure we
can see that, Development and Prodution both are connected with the continuous
pipeline of Code Commit, Build, Test, Release, Deliver/Deploy.
Developer starts with
thier respective code(s) whether they are code fixes (bug fixes) or they are
new module enhancement, once developer done with thier code, they will first
commit it, then they will run the build (here the main point that should be
notes is Maven---mostly used as build tool, provides continuous
build(s), for andriod Gradle is mostly used build tool), once
the build is successfull, developer will test thier changes or developed code
in the stagging or testing environment, after testing the code, code will be
directly released to the production or operational environment by eleminating
the manual QA process and from the production environment, code will be
deployed or delivered as per the requirement(s).
Lets us try to
understand the Jenkins working at the architecture
level, below architecture diagram will help us to understand the same:
Jenkins
Architecture...............
As we can see clearly in
the architecture, that Jenkins architecture starts with bunch of developers and
follows Jenkins Pipeline (discussed above) and ends with release to the production
server with continuous integrations from all the developers to central code
repository.
Thus we can conclude
that Jenkins starts from Devlopers leading to
CI---CD---CD and ends to Operatioals (Production) which is
nothing but DevOps.
Required/Available
Plugins for various services in Jenkins.....
In addition to CI/CD,
jenkins provides various plugins to provide extra services like Docker
(Container), AWS, Maven, GitHub, MS Build etc.
Developers in DevOps
practice, commonly uses Docker (Container) to give an isolation or independency
to an particular module or application during the development phase.
Besides,Docker, Maven is mostly used plugins by developers during DevOps
practice, to provide continuous Build process.
Types of Jenkins
Pipeline
Before going to types of
Jenkins Pipeline, we all must aware of 2 important technical terminologies:
Pipeline........A
Pipeline is a user-defined model of a CD pipeline. A Pipeline’s code defines
your entire build process, which typically includes stages for building an
application, testing it and then delivering it.
Also,
a pipeline block is a key part
of Declarative Pipeline syntax
Node.....A node is a machine which is part of the
Jenkins environment and is capable of executing a Pipeline.
Also, a node block is a key part of Scripted Pipeline syntax.
Stage.......A stage block defines a
conceptually distinct subset of tasks performed through the entire Pipeline
(e.g. "Build", "Test" and "Deploy" stages), which
is used by many plugins to visualize or present Jenkins Pipeline
status/progress.
Step......A single task. Fundamentally, a step
tells Jenkins what to do at a particular point in time (or
"step" in the process). For example, to execute the shell
command make use the sh step: sh 'make'. When a plugin
extends the Pipeline DSL,that typically means the plugin has implemented a
new step.
Declarative Pipeline fundamentals................
In Declarative
Pipeline syntax, the pipeline block defines all the work done
throughout your entire Pipeline.
Jenkinsfile
(Declarative Pipeline)
pipeline {
agent any 1
stages {
stage('Build') { 2
steps {
// 3
}
}
stage('Test') { 4
steps {
// 5
}
}
stage('Deploy') { 6
steps {
// 7
}
}
}
}
1: Execute this
Pipeline or any of its stages, on any available agent.
|
2: Defines the "Build" stage.
|
Comments
Post a Comment