Skip to main content

Command Palette

Search for a command to run...

Jenkins Freestyle jobs

Updated
3 min read

Jenkins offers various types of jobs, and it allows users to create jobs.

There are multiple types of jobs are there in Jenkins

here we are learning two types

  1. Freestyle

  2. Pipeline

What is Freestyle Job?

The purpose of the freestyle project is to implement, develop, or run simple jobs like allowing you to specify the version control system from which you are required to extract code and build it and call tests if available. Freestyle projects are meant to orchestrate simple jobs for a project.

What is Pipeline Job?

Pipeline Project is a new type of Jenkins project that is suitable either when you have to set up a continuous delivery pipeline or to define the deployment pipeline as code. The pipeline project applies to building pipelines for complex activities that are not suitable for freestyle projects.

Job Creation in Freestyle

  • Click on the new item

  • Enter the project name, select 'Freestyle Project,' and click 'OK'.

  • That's it, your job has been created.

Now, we'll discuss the configurations available in Freestyle Jobs.

Discard old builds
Here, we can specify the number of days to store old builds and the maximum number of builds to store.
Github project
We can specify the GitHub URL of our project.
This Project is parameterized
We can use this option when we want to provide parameters before starting the build.
Source Code Management
We need to specify the Git URL and branch that we want to build.

Build Triggers :

  • Build after other projects are built: We can start building the current job based on conditions such as:

    • Trigger only if upstream/downstream build is stable

    • Trigger even if the build is unstable

    • Trigger even if the build fails

    • Always trigger, even if the build is aborted

  • Build periodically

    • to schedule a build based on cron-pattern

    • It starts building at the scheduled time even if the repository doesn't have any changes.

  • GitHub hook trigger for GITScm polling

    • To start building automatically when any changes are made in the GitHub repository.

    • We have to use webhooks in github.

    • In GitHub, go to project settings and click on 'Webhooks'.

  • Poll SCM

    • It is similar to 'Build periodically,' but the only difference is that it triggers only when it finds any changes in the repository at the scheduled time.

Build Steps

Here, we are choosing Maven.

We need to choose the Maven version, and under 'Goals,' we have to provide the Maven commands.

ex: clean package

Post-build Actions

When we want to deploy, we need to install a plugin called 'Deploy to Container'.

Then, we need to choose 'Deploy to Container' under 'Post-build Actions'."

WAR/EAR files : location of war file

Context Path: name of our application

Containers:

we need to add our tomcat credentials and tomcat url.

More from this blog

Untitled Publication

12 posts