A: Explain the two types of pipeline in Jenkins, along with their syntax.
Jenkins provides two ways of developing a pipeline code: Scripted and Declarative.
A. Scripted Pipeline: It is based on Groovy script as their Domain Specific Language. One or more node blocks do the core work throughout the entire pipeline.
Syntax:
Executes the pipeline or any of its stages on any available agent
Defines the build stage
Performs steps related to building stage
Defines the test stage
Performs steps related to the test stage
Defines the deploy stage
Performs steps related to the deploy stage
B. Declarative Pipeline: It provides a simple and friendly syntax to define a pipeline. Here, the pipeline block defines the work done throughout the pipeline.
Syntax:
Executes the pipeline or any of its stages on any available agent
Defines the build stage
Performs steps related to building stage
Defines the test stage
Performs steps related to the test stage
Defines the deploy stage
Performs steps related to the deploy stage