2. “Continuous Integration (CI) is a
development practice that requires
developers to integrate code into a
shared repository several times a
day. Each check-in is then verified
by an automated build, allowing
teams to detect problems early.”
ContinuousIntegration
3. “Continuous deployment is a
strategy for software releases
wherein any code commit that
passes the automated testing
phase is automatically released
into the production environment,
making changes that are visible
to the software's users.”
Continuous Deployment
BUILD TEST DEPLOY
4. “Continuous delivery is a
software engineering approach in
which teams produce software in
short cycles, ensuring that the
software can be reliably released
at any time and, when releasing
the software, doing so manually.
It aims at building, testing, and
releasing software with greater
speed and frequency.”
Continuous Delivery
BUILD TEST
PROD
DEPLOY
MANUAL
9. Pipeline
Every Check-in Triggers
the pipeline execution
Feedback to the team in
every stage
So we say "Bring the pain
forward" or "Fail Fast Fail
Often "
Allows multiple users to
edit and execute the
pipeline process.
Pipelines are robust. So if
your server undergoes an
unforeseen restart, the
pipeline will be
automatically resumed.
You can pause the
pipeline process and
make it wait to resume
until there is an input
from the user.
You can Review and Audit
your Jenkins Pipeline
Code
Integrate with other
plugins easily
Restart from Save
checkpoints
10. What is a Jenkinsfile ?
A Text file that stores pipeline as code
It can be checked in to your source control or locally
Enable developers the flexibility of changing the file as per process
It is written using the Groovy DSL
Written based on 2 syntaxes
Declarative Pipeline and Scripted Pipeline
11. DECLARATIVE PIPELINE SCRIPTED PIPELINE
• In Trend
• Simpler groovy syntax
• Code is written locally in to a file and then
checked in to SCM
• The Code is Defined within the ‘pipeline’
block
• Traditional way of writing code
• Strict groovy syntax
• Code is written on Jenkins UI
• The code is defined within a ‘node’ block
DECLARATIVE v/s SCRIPTED PIPELINE
12. Pipeline concepts - Pipeline / Node
Pipeline : A user defined block which contains all the stages, it is a key part of declarative pipeline Syntax.
Node : A node is a machine that executes an entire workflow, it is a key part of the scripted pipeline syntax.
13. Agent : instructs Jenkins to allocate an executor for the builds It is defined for an entire pipeline or a specific stage.
It has following Parameters :
Any : Run Pipeline / Stage on any available agent
None : Applied at the root of the pipeline, indicates that there is no global agent for the entire pipeline & each stage must specify its own agent.
Label : Executes the pipeline/stage on the labelled agent
Docker : Uses Docker container as an execution environment for the pipeline or specific stage.
Pipeline concepts - Agent
14. Stages : It contains all the work, each stage performs a specific task. Steps : Steps are carried out in sequence to execute a stage
Pipeline concepts - Stages and Steps
17. This Snippet Generator will help you learn the Pipeline Script code which can be used to define
various steps. Pick a step you are interested in from the list, configure it, click Generate Pipeline Script,
and you will see a Pipeline Script statement that would call the step with that configuration. You may
copy and paste the whole statement into your script, or pick up just the options you care about.
Pipeline Snippet Generator
20. As Pipeline is adopted for more and more projects in an organization, common patterns are likely to emerge. Oftentimes it is useful to share parts of
Pipelines between various projects to reduce redundancies and keep code "DRY"
Pipeline has support for creating "Shared Libraries" which can be defined in external source control repositories and loaded into existing Pipelines.
Shared Pipeline Libraries
21. DEMO TIME : CREATING A SHARED PIPELINE LIBRARY
22. USING DOCKER WITH PIPELINE
Pipeline is designed to easily use Docker images as the execution environment
for a single stage or the entire Pipeline.
24. BEST PRACTICES
Do: Use the real
Jenkins Pipeline
Do: Develop your
pipeline as code
Do: All work
within a stage
Do: All material
work within
a node
Do: Work you can
within a
parallel step
Do: Acquire
nodes within
parallel steps
Don’t: Use input
within a
node block
Do: Wrap your
inputs in
a timeout
25. More questions about Jenkins Pipeline?
Thank You !
@MohdImranAnsari Mohammad Imran Ansari https://www.linkedin.com/in/mohdimranansari
VISIT https://jenkins.io/doc/