Let’s look at some of the differences between Jenkins freestyle and pipeline jobs.
Table of Contents
Freestyle Jobs
You configure a freestyle job in Jenkins using the GUI by adding steps to the build. Freestyle jobs give you a lot of flexibility. But, you will struggle to configure complex continuous delivery scenarios.
Pipeline Jobs
Pipeline jobs allow you to create a set of instructions using code. You can also easily visualize different stages in one place. Most importantly, you can keep all the code stored in a code repository. This will, in turn, allow you to version, audit, and keep track of changes.
Pipeline jobs are created using a Jenkinsfile. And Jenkinsfiles uses Apache Groovy as the scripting language.
A Jenkinsfile can use either of the following two syntaxes:
- Declarative Pipelines – The declarative pipeline requires the Blue Ocean plugin. This plugin provides a graphical pipeline editor.
- Scripted Pipelines – The scripted pipeline allows you to use the Jenkinsfile. But here you can use standard Jenkins.
Also, a Jenkins pipeline consists of many components.
These are:
- Steps are single tasks that tell Jenkins what to do.
- Stages groupings of steps like build, test and deploy.
For example, we can have a stage called “test”. And the “test” can, in turn, run many steps to test our code, the deployments, and more.
Wrapping up Jenkins freestyle vs pipeline jobs
As you can see, you set up freestyle jobs in Jenkins with the GUI. But, you use pipeline jobs to code more complex jobs using Jenkisfiles.