Understanding the Sections of Freestyle Project
There are 6 sections in a freestyle project named as follows:
- Source Code Management
- Build Triggers
- Build Environment
- Post-build Actions
Note: Every section has several options and all are explained in the Question mark “?” icon at the right.
Let’s get a brief idea about some more useful options in these sections.
1. General –
✔ This section has the Description field of the project in which you can describe the project.
✔ This has an option to Discard old builds that is useful if you don’t want to see all the builds piled up in the build history of the project. You can choose how old builds you want to keep.
✔ Provide the GitHub project URL here.
✔ You can add parameters (variables) by checking “This project is parameterized” that can be used in this project.
✔ There are other options like disabling build, execute concurrent build and if you add some plugins later on then that may also increase the options in this section like Docker-related options.
2. Source Code Management –
This section has the option to add Git repositories for the project.
3. Build Triggers
This section has different options to trigger the build(project).
✔ Trigger builds remotely are triggering the project by using some tokens which can be used in some URLs or in a script.
✔ Next is starting the build after some other projects are built.
✔ The option build periodically options uses cron expressions to schedule the build.
✔ Github webhook can be used in the next option to trigger the project.
✔ Poll SCM also uses cron expression but this option uses to check for the changes in git repositories and as soon as it detects any changes, it triggers the project.
4. Build Environment –
This has several options to use before the actual build tasks and some options are as follows:
You can delete the workspace every time the build starts.
✔ You can add secrets, certificates, credentials, etc in the Use secret test(s) or file(s) option.
✔ Sending or running a command on a server over SSH can be done by choosing the options in this section.
✔ Use Ant to run the build.
5. Build –
This section has the main component in which we can add tasks to build, test, deploy, etc.
6. Post-build Actions –
These are the actions or tasks we add to be run after the build is completed such as creating an archive of artifacts, sending email notifications, building other projects, etc.
We have understood the different components of a Freestyle project. In the next module, we will create a demo freestyle Jenkins Job.